Bug 951793 - Obey overscroll-behavior for swipe navigation. r=mstange
MozReview-Commit-ID: i2BuiAfG71
This commit is contained in:
committed by
Emilio Cobos Álvarez
parent
64df194b8d
commit
3f81b77b00
@@ -1198,6 +1198,9 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
panInput.mPanStartPoint = *untransformedStartPoint;
|
||||
panInput.mPanDisplacement = *untransformedDisplacement;
|
||||
|
||||
panInput.mOverscrollBehaviorAllowsSwipe =
|
||||
apzc->OverscrollBehaviorAllowsSwipe();
|
||||
}
|
||||
break;
|
||||
} case PINCHGESTURE_INPUT: { // note: no one currently sends these
|
||||
|
||||
@@ -2880,6 +2880,12 @@ ParentLayerPoint AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehav
|
||||
return residualVelocity;
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::OverscrollBehaviorAllowsSwipe() const
|
||||
{
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
// Swipe navigation is a "non-local" overscroll behavior like handoff.
|
||||
return mX.OverscrollBehaviorAllowsHandoff();
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::HandleFlingOverscroll(const ParentLayerPoint& aVelocity,
|
||||
const RefPtr<const OverscrollHandoffChain>& aOverscrollHandoffChain,
|
||||
|
||||
@@ -442,6 +442,8 @@ public:
|
||||
|
||||
void NotifyMozMouseScrollEvent(const nsString& aString) const;
|
||||
|
||||
bool OverscrollBehaviorAllowsSwipe() const;
|
||||
|
||||
protected:
|
||||
// Protected destructor, to discourage deletion outside of Release():
|
||||
virtual ~AsyncPanZoomController();
|
||||
|
||||
@@ -490,6 +490,7 @@ PanGestureInput::PanGestureInput()
|
||||
, mHandledByAPZ(false)
|
||||
, mFollowedByMomentum(false)
|
||||
, mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
||||
, mOverscrollBehaviorAllowsSwipe(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -509,6 +510,7 @@ PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
||||
, mHandledByAPZ(false)
|
||||
, mFollowedByMomentum(false)
|
||||
, mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
|
||||
, mOverscrollBehaviorAllowsSwipe(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -385,6 +385,14 @@ public:
|
||||
// confirmed target.
|
||||
// This is used by events that can result in a swipe instead of a scroll.
|
||||
bool mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection;
|
||||
|
||||
// This is used by APZ to communicate to the macOS widget code whether
|
||||
// the overscroll-behavior of the scroll frame handling this swipe allows
|
||||
// non-local overscroll behaviors in the horizontal direction (such as
|
||||
// swipe navigation).
|
||||
bool mOverscrollBehaviorAllowsSwipe;
|
||||
|
||||
// XXX: If adding any more bools, switch to using bitfields instead.
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2923,7 +2923,7 @@ nsChildView::DispatchAPZWheelInputEvent(InputData& aEvent, bool aCanTriggerSwipe
|
||||
PanGestureInput& panInput = aEvent.AsPanGestureInput();
|
||||
|
||||
event = panInput.ToWidgetWheelEvent(this);
|
||||
if (aCanTriggerSwipe) {
|
||||
if (aCanTriggerSwipe && panInput.mOverscrollBehaviorAllowsSwipe) {
|
||||
SwipeInfo swipeInfo = SendMayStartSwipe(panInput);
|
||||
event.mCanTriggerSwipe = swipeInfo.wantsSwipe;
|
||||
if (swipeInfo.wantsSwipe) {
|
||||
|
||||
@@ -1225,6 +1225,7 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||
WriteParam(aMsg, aParam.mHandledByAPZ);
|
||||
WriteParam(aMsg, aParam.mFollowedByMomentum);
|
||||
WriteParam(aMsg, aParam.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
||||
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
@@ -1241,7 +1242,8 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||
ReadParam(aMsg, aIter, &aResult->mUserDeltaMultiplierY) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHandledByAPZ) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFollowedByMomentum) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
||||
ReadParam(aMsg, aIter, &aResult->mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mOverscrollBehaviorAllowsSwipe);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user