Bug 795567 - Part 5: Add zoom prevention based on the touch-action value. r=kats
This commit is contained in:
@@ -758,6 +758,11 @@ nsEventStatus AsyncPanZoomController::OnTouchCancel(const MultiTouchInput& aEven
|
|||||||
|
|
||||||
nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEvent) {
|
nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEvent) {
|
||||||
APZC_LOG("%p got a scale-begin in state %d\n", this, mState);
|
APZC_LOG("%p got a scale-begin in state %d\n", this, mState);
|
||||||
|
|
||||||
|
if (!TouchActionAllowZoom()) {
|
||||||
|
return nsEventStatus_eIgnore;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mZoomConstraints.mAllowZoom) {
|
if (!mZoomConstraints.mAllowZoom) {
|
||||||
return nsEventStatus_eConsumeNoDefault;
|
return nsEventStatus_eConsumeNoDefault;
|
||||||
}
|
}
|
||||||
@@ -1726,6 +1731,22 @@ void AsyncPanZoomController::CheckContentResponse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AsyncPanZoomController::TouchActionAllowZoom() {
|
||||||
|
if (!mTouchActionPropertyEnabled) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pointer events specification implies all touch points to allow zoom
|
||||||
|
// to perform it.
|
||||||
|
for (size_t i = 0; i < mAllowedTouchBehaviors.Length(); i++) {
|
||||||
|
if (!(mAllowedTouchBehaviors[i] & AllowedTouchBehavior::ZOOM)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
AsyncPanZoomController::TouchBehaviorFlags
|
AsyncPanZoomController::TouchBehaviorFlags
|
||||||
AsyncPanZoomController::GetTouchBehavior(uint32_t touchIndex) {
|
AsyncPanZoomController::GetTouchBehavior(uint32_t touchIndex) {
|
||||||
if (touchIndex < mAllowedTouchBehaviors.Length()) {
|
if (touchIndex < mAllowedTouchBehaviors.Length()) {
|
||||||
|
|||||||
@@ -538,6 +538,11 @@ private:
|
|||||||
was not set yet. we still need to abort animations. */
|
was not set yet. we still need to abort animations. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns whether current touch behavior values allow zooming.
|
||||||
|
*/
|
||||||
|
bool TouchActionAllowZoom();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns allowed touch behavior from the mAllowedTouchBehavior array.
|
* Returns allowed touch behavior from the mAllowedTouchBehavior array.
|
||||||
* In case apzc didn't receive touch behavior values within the timeout
|
* In case apzc didn't receive touch behavior values within the timeout
|
||||||
|
|||||||
Reference in New Issue
Block a user