forked from mirrors/gecko-dev
Bug 1794070 - Introduce PanGestureInput::AllowsSwipe(). r=botond
Differential Revision: https://phabricator.services.mozilla.com/D160437
This commit is contained in:
parent
f7ce055162
commit
d32e0125e8
3 changed files with 15 additions and 3 deletions
|
|
@ -453,8 +453,8 @@ APZEventResult InputQueue::ReceivePanGestureInput(
|
|||
CancelAnimationsForNewBlock(block);
|
||||
MaybeRequestContentResponse(aTarget, block);
|
||||
|
||||
if (aFlags.mTargetConfirmed && event.mOverscrollBehaviorAllowsSwipe &&
|
||||
event.MayTriggerSwipe() && !CanScrollTargetHorizontally(event, block)) {
|
||||
if (aFlags.mTargetConfirmed && event.AllowsSwipe() &&
|
||||
!CanScrollTargetHorizontally(event, block)) {
|
||||
// This event may trigger a swipe gesture, depending on what our caller
|
||||
// wants to do it. We need to suspend handling of this block until we get
|
||||
// a content response which will tell us whether to proceed or abort the
|
||||
|
|
|
|||
|
|
@ -426,6 +426,18 @@ class PanGestureInput : public InputData {
|
|||
void SetIsNoLineOrPageDelta(bool aIsNoLineOrPageDelta) {
|
||||
mIsNoLineOrPageDelta = aIsNoLineOrPageDelta;
|
||||
}
|
||||
|
||||
// Returns true if this pan gesture event is elligible for browser swipe
|
||||
// gesture considering the overscroll-behavior property of the target
|
||||
// scroll container.
|
||||
bool AllowsSwipe() const {
|
||||
MOZ_ASSERT(mHandledByAPZ);
|
||||
return mMayTriggerSwipe && mOverscrollBehaviorAllowsSwipe;
|
||||
}
|
||||
|
||||
// Similar to above AllowsSwipe() but this doesn't care the
|
||||
// overscroll-behavior property, this function should be only used for cases
|
||||
// where APZ isn't involved.
|
||||
bool MayTriggerSwipe() const { return mMayTriggerSwipe; }
|
||||
bool RequiresContentResponseIfCannotScrollHorizontallyInStartDirection();
|
||||
|
||||
|
|
|
|||
|
|
@ -2295,7 +2295,7 @@ nsBaseWidget::SwipeInfo nsBaseWidget::SendMayStartSwipe(
|
|||
WidgetWheelEvent nsBaseWidget::MayStartSwipeForAPZ(
|
||||
const PanGestureInput& aPanInput, const APZEventResult& aApzResult) {
|
||||
WidgetWheelEvent event = aPanInput.ToWidgetEvent(this);
|
||||
if (aPanInput.MayTriggerSwipe() && aPanInput.mOverscrollBehaviorAllowsSwipe) {
|
||||
if (aPanInput.AllowsSwipe()) {
|
||||
SwipeInfo swipeInfo = SendMayStartSwipe(aPanInput);
|
||||
event.mCanTriggerSwipe = swipeInfo.wantsSwipe;
|
||||
if (swipeInfo.wantsSwipe) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue