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),
|
mFollowedByMomentum(false),
|
||||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||||
mOverscrollBehaviorAllowsSwipe(false),
|
mOverscrollBehaviorAllowsSwipe(false),
|
||||||
mSimulateMomentum(false) {}
|
mSimulateMomentum(false),
|
||||||
|
mIsNoLineOrPageDelta(true) {}
|
||||||
|
|
||||||
PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
||||||
TimeStamp aTimeStamp,
|
TimeStamp aTimeStamp,
|
||||||
|
|
@ -449,7 +450,15 @@ PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
|
||||||
mFollowedByMomentum(false),
|
mFollowedByMomentum(false),
|
||||||
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false),
|
||||||
mOverscrollBehaviorAllowsSwipe(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 {
|
bool PanGestureInput::IsMomentum() const {
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
|
|
@ -480,10 +489,12 @@ WidgetWheelEvent PanGestureInput::ToWidgetEvent(nsIWidget* aWidget) const {
|
||||||
wheelEvent.mDeltaY = mPanDisplacement.y;
|
wheelEvent.mDeltaY = mPanDisplacement.y;
|
||||||
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
|
||||||
wheelEvent.mFocusSequenceNumber = mFocusSequenceNumber;
|
wheelEvent.mFocusSequenceNumber = mFocusSequenceNumber;
|
||||||
|
wheelEvent.mIsNoLineOrPageDelta = mIsNoLineOrPageDelta;
|
||||||
if (mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
if (mDeltaType == PanGestureInput::PANDELTA_PAGE) {
|
||||||
|
// widget/gtk is currently the only consumer that uses delta type
|
||||||
|
// PANDELTA_PAGE
|
||||||
// Emulate legacy widget/gtk behavior
|
// Emulate legacy widget/gtk behavior
|
||||||
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_LINE;
|
wheelEvent.mDeltaMode = WheelEvent_Binding::DOM_DELTA_LINE;
|
||||||
wheelEvent.mIsNoLineOrPageDelta = true;
|
|
||||||
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
wheelEvent.mScrollType = WidgetWheelEvent::SCROLL_ASYNCHRONOUSELY;
|
||||||
wheelEvent.mDeltaX *= 3;
|
wheelEvent.mDeltaX *= 3;
|
||||||
wheelEvent.mDeltaY *= 3;
|
wheelEvent.mDeltaY *= 3;
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,9 @@ class PanGestureInput : public InputData {
|
||||||
const ScreenPoint& aPanStartPoint,
|
const ScreenPoint& aPanStartPoint,
|
||||||
const ScreenPoint& aPanDisplacement, Modifiers aModifiers);
|
const ScreenPoint& aPanDisplacement, Modifiers aModifiers);
|
||||||
|
|
||||||
|
void SetLineOrPageDeltas(int32_t aLineOrPageDeltaX,
|
||||||
|
int32_t aLineOrPageDeltaY);
|
||||||
|
|
||||||
bool IsMomentum() const;
|
bool IsMomentum() const;
|
||||||
|
|
||||||
WidgetWheelEvent ToWidgetEvent(nsIWidget* aWidget) const;
|
WidgetWheelEvent ToWidgetEvent(nsIWidget* aWidget) const;
|
||||||
|
|
@ -456,6 +459,13 @@ class PanGestureInput : public InputData {
|
||||||
// events.)
|
// events.)
|
||||||
bool mSimulateMomentum : 1;
|
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 SetHandledByAPZ(bool aHandled) { mHandledByAPZ = aHandled; }
|
||||||
void SetFollowedByMomentum(bool aFollowed) {
|
void SetFollowedByMomentum(bool aFollowed) {
|
||||||
mFollowedByMomentum = aFollowed;
|
mFollowedByMomentum = aFollowed;
|
||||||
|
|
@ -469,6 +479,9 @@ class PanGestureInput : public InputData {
|
||||||
mOverscrollBehaviorAllowsSwipe = aAllows;
|
mOverscrollBehaviorAllowsSwipe = aAllows;
|
||||||
}
|
}
|
||||||
void SetSimulateMomentum(bool aSimulate) { mSimulateMomentum = aSimulate; }
|
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) {
|
if (usePreciseDeltas && hasPhaseInformation) {
|
||||||
PanGestureInput panEvent(PanGestureTypeForEvent(theEvent), eventIntervalTime, eventTimeStamp,
|
PanGestureInput panEvent(PanGestureTypeForEvent(theEvent), eventIntervalTime, eventTimeStamp,
|
||||||
position, preciseDelta, modifiers);
|
position, preciseDelta, modifiers);
|
||||||
panEvent.mLineOrPageDeltaX = lineOrPageDelta.x;
|
panEvent.SetLineOrPageDeltas(lineOrPageDelta.x, lineOrPageDelta.y);
|
||||||
panEvent.mLineOrPageDeltaY = lineOrPageDelta.y;
|
|
||||||
|
|
||||||
if (panEvent.mType == PanGestureInput::PANGESTURE_END) {
|
if (panEvent.mType == PanGestureInput::PANGESTURE_END) {
|
||||||
// Check if there's a momentum start event in the event queue, so that we
|
// Check if there's a momentum start event in the event queue, so that we
|
||||||
|
|
|
||||||
|
|
@ -1237,6 +1237,7 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||||
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
.mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection);
|
||||||
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
WriteParam(aMsg, aParam.mOverscrollBehaviorAllowsSwipe);
|
||||||
WriteParam(aMsg, aParam.mSimulateMomentum);
|
WriteParam(aMsg, aParam.mSimulateMomentum);
|
||||||
|
WriteParam(aMsg, aParam.mIsNoLineOrPageDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||||
|
|
@ -1263,7 +1264,9 @@ struct ParamTraits<mozilla::PanGestureInput>
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
ReadBoolForBitfield(aMsg, aIter, aResult,
|
||||||
¶mType::SetOverscrollBehaviorAllowsSwipe) &&
|
¶mType::SetOverscrollBehaviorAllowsSwipe) &&
|
||||||
ReadBoolForBitfield(aMsg, aIter, aResult,
|
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,
|
PanGestureInput event{panGestureType, eventIntervalTime, eventTimeStamp,
|
||||||
position, ScreenPoint(x, y), mods};
|
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);
|
mWindow->SendAnAPZEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue