зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1784772 - Preserve APZEventResult.mHandledResult when we set `eConsumeDoDefault` for the APZEventResult in InputQueue::ReceivePanGestureInput(). r=botond
The `mHandledResult` is set in the ctor of APZEventResult based on an incoming TargetConfirmationFlags, we shouldn't clobber the original `mHandledResult` when we set `eConsumeDoDefault` for pan events. Note that we should probably do the same thing for other SetStatusAsConsumeDoDefault call sites basically, but for now I'd like to make this change as mimumum as possible. Differential Revision: https://phabricator.services.mozilla.com/D172525
This commit is contained in:
Родитель
d96b738428
Коммит
be5af8fe49
|
@ -102,6 +102,14 @@ struct APZEventResult {
|
|||
// depending on |aTarget|.
|
||||
void SetStatusAsConsumeDoDefault(
|
||||
const RefPtr<AsyncPanZoomController>& aTarget);
|
||||
|
||||
// Set mStatus to nsEventStatus_eConsumeDoDefault, unlike above
|
||||
// SetStatusAsConsumeDoDefault(const RefPtr<AsyncPanZoomController>&) this
|
||||
// function doesn't mutate mHandledResult.
|
||||
void SetStatusAsConsumeDoDefault() {
|
||||
mStatus = nsEventStatus_eConsumeDoDefault;
|
||||
}
|
||||
|
||||
// Set mStatus to nsEventStatus_eConsumeDoDefault and set mHandledResult
|
||||
// depending on |aBlock|'s target APZC.
|
||||
void SetStatusAsConsumeDoDefault(const InputBlockState& aBlock);
|
||||
|
|
|
@ -426,7 +426,14 @@ APZEventResult InputQueue::ReceivePanGestureInput(
|
|||
}
|
||||
|
||||
PanGestureInput event = aEvent;
|
||||
result.SetStatusAsConsumeDoDefault(aTarget);
|
||||
|
||||
// Below `SetStatusAsConsumeDoDefault()` preserves `mHandledResult` of
|
||||
// `result` which was set in the ctor of APZEventResult at the top of this
|
||||
// function based on `aFlag` so that the `mHandledResult` value is reliable to
|
||||
// tell whether the event will be handled by the root content APZC at least
|
||||
// for swipe-navigation stuff. E.g. if a pan-start event scrolled the root
|
||||
// scroll container, we don't need to anything for swipe-navigation.
|
||||
result.SetStatusAsConsumeDoDefault();
|
||||
|
||||
if (!block || block->WasInterrupted()) {
|
||||
if (event.mType == PanGestureInput::PANGESTURE_MOMENTUMSTART ||
|
||||
|
|
|
@ -1130,6 +1130,31 @@ add_task(async () => {
|
|||
});
|
||||
});
|
||||
|
||||
// Set up an APZ aware event listener and...
|
||||
await SpecialPowers.spawn(tab.linkedBrowser, [], async () => {
|
||||
content.document.documentElement.addEventListener("wheel", e => {}, {
|
||||
passive: false,
|
||||
});
|
||||
await content.wrappedJSObject.promiseApzFlushedRepaints();
|
||||
});
|
||||
|
||||
// Try to swipe back again without overscrolling to make sure swipe-navigation
|
||||
// works with the APZ aware event listener.
|
||||
await panLeftToRight(tab.linkedBrowser, 100, 100, 1);
|
||||
|
||||
let startLoadingPromise = BrowserTestUtils.browserStarted(
|
||||
tab.linkedBrowser,
|
||||
"about:about"
|
||||
);
|
||||
let stoppedLoadingPromise = BrowserTestUtils.browserStopped(
|
||||
tab.linkedBrowser,
|
||||
"about:about"
|
||||
);
|
||||
|
||||
await Promise.all([startLoadingPromise, stoppedLoadingPromise]);
|
||||
|
||||
ok(gBrowser.webNavigation.canGoForward);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче