forked from mirrors/gecko-dev
Bug 1678771. Set mIsNoLineOrPageDelta on WidgetWheelEvents we create from PanGestureInput when we don't know the line scroll amount so EventStateManager will fill those in for us. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D114358
This commit is contained in:
parent
162a8620f1
commit
7bc93b89f5
5 changed files with 32 additions and 11 deletions
|
|
@ -430,7 +430,8 @@ PanGestureInput::PanGestureInput()
|
|||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||
mOverscrollBehaviorAllowsSwipe(false),
|
||||
mSimulateMomentum(false) {}
|
||||
mSimulateMomentum(false),
|
||||
mIsNoLineOrPageDelta(true) {}
|
||||
|
||||
PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
||||
TimeStamp aTimeStamp,
|
||||
|
|
@ -449,7 +450,15 @@ PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
|||
mFollowedByMomentum(false),
|
||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||
mOverscrollBehaviorAllowsSwipe(false),
|
||||
mSimulateMomentum(false) {}
|
||||
mSimulateMomentum(false),
|
||||
mIsNoLineOrPageDelta(true) {}
|
||||
|
||||
void PanGestureInput::SetLineOrPageDeltas(int32_t aLineOrPageDeltaX,
|
||||
int32_t aLineOrPageDeltaY) {
|
||||
mLineOrPageDeltaX = aLineOrPageDeltaX;
|
||||
mLineOrPageDeltaY = aLineOrPageDeltaY;
|
||||
mIsNoLineOrPageDelta = false;
|
||||
}
|
||||
|
||||
bool PanGestureInput::IsMomentum() const {
|
||||
switch (mType) {
|
||||
|
|
@ -480,10 +489,12 @@ WidgetWheelEvent PanGestureInput::ToWidgetEvent(nsIWidget* aWidget) const {
|
|||
wheelEvent.mDeltaY = mPanDisplacement.y;
|
||||
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
||||
wheelEvent.mFocusSequenceNumber = mFocusSequenceNumber;
|
||||
wheelEvent.mIsNoLineOrPageDelta = mIsNoLineOrPageDelta;
|
||||
if (mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
||||
// widget/gtk is currently the only consumer that uses delta type
|
||||
// PANDELTA_PAGE
|
||||
// Emulate legacy widget/gtk behavior
|
||||
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_LINE;
|
||||
wheelEvent.mIsNoLineOrPageDelta = true;
|
||||
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
||||
wheelEvent.mDeltaX *= 3;
|
||||
wheelEvent.mDeltaY *= 3;
|
||||
|
|
|
|||
|
|
@ -397,6 +397,9 @@ class PanGestureInput : public InputData {
|
|||
const ScreenPoint& aPanStartPoint,
|
||||
const ScreenPoint& aPanDisplacement, Modifiers aModifiers);
|
||||
|
||||
void SetLineOrPageDeltas(int32_t aLineOrPageDeltaX,
|
||||
int32_t aLineOrPageDeltaY);
|
||||
|
||||
bool IsMomentum() const;
|
||||
|
||||
WidgetWheelEvent ToWidgetEvent(nsIWidget* aWidget) const;
|
||||
|
|
@ -456,6 +459,13 @@ class PanGestureInput : public InputData {
|
|||
// events.)
|
||||
bool mSimulateMomentum : 1;
|
||||
|
||||
// true if the creator of this object does not set the mLineOrPageDeltaX/Y
|
||||
// fields and when/if WidgetWheelEvent's are generated from this object wants
|
||||
// the corresponding mLineOrPageDeltaX/Y fields in the WidgetWheelEvent to be
|
||||
// automatically calculated (upon event dispatch by the EventStateManager
|
||||
// code).
|
||||
bool mIsNoLineOrPageDelta : 1;
|
||||
|
||||
void SetHandledByAPZ(bool aHandled) { mHandledByAPZ = aHandled; }
|
||||
void SetFollowedByMomentum(bool aFollowed) {
|
||||
mFollowedByMomentum = aFollowed;
|
||||
|
|
@ -469,6 +479,9 @@ class PanGestureInput : public InputData {
|
|||
mOverscrollBehaviorAllowsSwipe = aAllows;
|
||||
}
|
||||
void SetSimulateMomentum(bool aSimulate) { mSimulateMomentum = aSimulate; }
|
||||
void SetIsNoLineOrPageDelta(bool aIsNoLineOrPageDelta) {
|
||||
mIsNoLineOrPageDelta = aIsNoLineOrPageDelta;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3393,8 +3393,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
if (usePreciseDeltas && hasPhaseInformation) {
|
||||
PanGestureInput panEvent(PanGestureTypeForEvent(theEvent), eventIntervalTime, eventTimeStamp,
|
||||
position, preciseDelta, modifiers);
|
||||
panEvent.mLineOrPageDeltaX = lineOrPageDelta.x;
|
||||
panEvent.mLineOrPageDeltaY = lineOrPageDelta.y;
|
||||
panEvent.SetLineOrPageDeltas(lineOrPageDelta.x, lineOrPageDelta.y);
|
||||
|
||||
if (panEvent.mType == PanGestureInput::PANGESTURE_END) {
|
||||
// Check if there's a momentum start event in the event queue, so that we
|
||||
|
|
|
|||
|
|
@ -1237,6 +1237,7 @@ struct ParamTraits<mozilla::PanGestureInput>
|
|||
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
||||
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
||||
WriteParam(aMsg, aParam.mSimulateMomentum);
|
||||
WriteParam(aMsg, aParam.mIsNoLineOrPageDelta);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
|
|
@ -1263,7 +1264,9 @@ struct ParamTraits<mozilla::PanGestureInput>
|
|||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||
¶mType::SetOverscrollBehaviorAllowsSwipe) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||
¶mType::SetSimulateMomentum);
|
||||
¶mType::SetSimulateMomentum) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||
¶mType::SetIsNoLineOrPageDelta);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -506,11 +506,6 @@ void DManipEventHandler::SendPan(Phase aPhase, float x, float y,
|
|||
PanGestureInput event{panGestureType, eventIntervalTime, eventTimeStamp,
|
||||
position, ScreenPoint(x, y), mods};
|
||||
|
||||
gfx::IntPoint lineOrPageDelta =
|
||||
PanGestureInput::GetIntegerDeltaForEvent((aPhase == Phase::eStart), x, y);
|
||||
event.mLineOrPageDeltaX = lineOrPageDelta.x;
|
||||
event.mLineOrPageDeltaY = lineOrPageDelta.y;
|
||||
|
||||
mWindow->SendAnAPZEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue