Bug 1235994 - Add a flag to wheel events to track if they may have momentum following them. r=mstange

This commit is contained in:
Kartikaya Gupta 2016-01-07 10:39:37 -05:00
parent 93e432ea0b
commit cbb0997aca
4 changed files with 11 additions and 0 deletions

View File

@ -307,6 +307,7 @@ PanGestureInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
wheelEvent.buttons = 0;
wheelEvent.deltaMode = nsIDOMWheelEvent::DOM_DELTA_PIXEL;
wheelEvent.mayHaveMomentum = true; // pan inputs may have momentum
wheelEvent.isMomentum = IsMomentum();
wheelEvent.lineOrPageDeltaX = mLineOrPageDeltaX;
wheelEvent.lineOrPageDeltaY = mLineOrPageDeltaY;
@ -380,6 +381,7 @@ ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent) :
mLineOrPageDeltaY(aWheelEvent.lineOrPageDeltaY),
mUserDeltaMultiplierX(1.0),
mUserDeltaMultiplierY(1.0),
mMayHaveMomentum(aWheelEvent.mayHaveMomentum),
mIsMomentum(aWheelEvent.isMomentum)
{
mOrigin =
@ -399,6 +401,7 @@ ScrollWheelInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
wheelEvent.buttons = 0;
wheelEvent.deltaMode = DeltaModeForDeltaType(mDeltaType);
wheelEvent.mayHaveMomentum = mMayHaveMomentum;
wheelEvent.isMomentum = mIsMomentum;
wheelEvent.deltaX = mDeltaX;
wheelEvent.deltaY = mDeltaY;

View File

@ -585,6 +585,7 @@ public:
mScrollSeriesNumber(0),
mUserDeltaMultiplierX(1.0),
mUserDeltaMultiplierY(1.0),
mMayHaveMomentum(false),
mIsMomentum(false)
{}
@ -628,6 +629,7 @@ public:
double mUserDeltaMultiplierX;
double mUserDeltaMultiplierY;
bool mMayHaveMomentum;
bool mIsMomentum;
};

View File

@ -449,6 +449,7 @@ public:
, deltaZ(0.0)
, deltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
, customizedByUserPrefs(false)
, mayHaveMomentum(false)
, isMomentum(false)
, mIsNoLineOrPageDelta(false)
, lineOrPageDeltaX(0)
@ -499,6 +500,8 @@ public:
// Otherwise, i.e., they are computed from native events, false.
bool customizedByUserPrefs;
// true if the momentum events directly tied to this event may follow it.
bool mayHaveMomentum;
// true if the event is caused by momentum.
bool isMomentum;
@ -579,6 +582,7 @@ public:
deltaZ = aEvent.deltaZ;
deltaMode = aEvent.deltaMode;
customizedByUserPrefs = aEvent.customizedByUserPrefs;
mayHaveMomentum = aEvent.mayHaveMomentum;
isMomentum = aEvent.isMomentum;
mIsNoLineOrPageDelta = aEvent.mIsNoLineOrPageDelta;
lineOrPageDeltaX = aEvent.lineOrPageDeltaX;

View File

@ -165,6 +165,7 @@ struct ParamTraits<mozilla::WidgetWheelEvent>
WriteParam(aMsg, aParam.deltaZ);
WriteParam(aMsg, aParam.deltaMode);
WriteParam(aMsg, aParam.customizedByUserPrefs);
WriteParam(aMsg, aParam.mayHaveMomentum);
WriteParam(aMsg, aParam.isMomentum);
WriteParam(aMsg, aParam.mIsNoLineOrPageDelta);
WriteParam(aMsg, aParam.lineOrPageDeltaX);
@ -187,6 +188,7 @@ struct ParamTraits<mozilla::WidgetWheelEvent>
ReadParam(aMsg, aIter, &aResult->deltaZ) &&
ReadParam(aMsg, aIter, &aResult->deltaMode) &&
ReadParam(aMsg, aIter, &aResult->customizedByUserPrefs) &&
ReadParam(aMsg, aIter, &aResult->mayHaveMomentum) &&
ReadParam(aMsg, aIter, &aResult->isMomentum) &&
ReadParam(aMsg, aIter, &aResult->mIsNoLineOrPageDelta) &&
ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaX) &&