From 0c402339141d098931744e866689cd277f50f094 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 7 Jan 2016 10:39:37 -0500 Subject: [PATCH] Bug 1235994 - Add a flag to wheel events to track if they may have momentum following them. r=mstange --HG-- extra : commitid : EAEUoOFxeOj --- widget/InputData.cpp | 3 +++ widget/InputData.h | 2 ++ widget/MouseEvents.h | 4 ++++ widget/nsGUIEventIPC.h | 2 ++ 4 files changed, 11 insertions(+) diff --git a/widget/InputData.cpp b/widget/InputData.cpp index 86726e6f9eb3..273c796c77ca 100644 --- a/widget/InputData.cpp +++ b/widget/InputData.cpp @@ -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; diff --git a/widget/InputData.h b/widget/InputData.h index cb9530e98e11..a6191bd764a5 100644 --- a/widget/InputData.h +++ b/widget/InputData.h @@ -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; }; diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index f4056c67010b..3c123f140b66 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -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; diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index 3662eefeecc8..424b94017872 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -165,6 +165,7 @@ struct ParamTraits 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 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) &&