From 2c527faa56cdc3a05148182bdc265510d0788ac5 Mon Sep 17 00:00:00 2001 From: Shih-Chiang Chien Date: Fri, 11 Jan 2013 11:02:02 +0100 Subject: [PATCH] Bug 828367 - APZC should not perform scrolling if BES detects panning distance is too small. r=cjones. --- dom/browser-element/BrowserElementScrolling.js | 13 ++++++++++--- gfx/layers/ipc/AsyncPanZoomController.cpp | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dom/browser-element/BrowserElementScrolling.js b/dom/browser-element/BrowserElementScrolling.js index 84ee9c16650..71d7c156426 100644 --- a/dom/browser-element/BrowserElementScrolling.js +++ b/dom/browser-element/BrowserElementScrolling.js @@ -233,10 +233,19 @@ const ContentPanning = { } let isPan = KineticPanning.isPan(); + if (!isPan) { + // If panning distance is not large enough, both BES and APZC + // should not perform scrolling + evt.preventDefault(); + return; + } + + let isScroll = this.scrollCallback(delta.scale(-1)); + if (this.detectingScrolling) { this.detectingScrolling = false; // Stop async-pan-zooming if the user is panning the subframe. - if (isPan) { + if (isScroll) { // We're going to drive synchronously scrolling an inner frame. Services.obs.notifyObservers(docShell, 'cancel-default-pan-zoom', null); } else { @@ -246,8 +255,6 @@ const ContentPanning = { } } - this.scrollCallback(delta.scale(-1)); - // If a pan action happens, cancel the active state of the // current target. if (!this.panning && isPan) { diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index 06598773c17..7176b2a1ad1 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -1421,7 +1421,7 @@ void AsyncPanZoomController::ContentReceivedTouch(bool aPreventDefault) { while (!mTouchQueue.IsEmpty()) { // we need to reset mDelayPanning before handling scrolling gesture. - if (mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_MOVE) { + if (!aPreventDefault && mTouchQueue[0].mType == MultiTouchInput::MULTITOUCH_MOVE) { mDelayPanning = false; } if (!aPreventDefault) {