Bug 1458063 - Propagate the APZWheelAction to APZCTreeManager. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Wed, 02 May 2018 12:57:23 -0400
changeset 790825 6e42ce08841c44b7c637ddbd878b5372d5d1225b
parent 790824 2ea04360700530e1fbbbaaf94b484b6df2f79fe4
child 790826 c2090b54e21f885876808a68347421f277ca66c3
push id108607
push userbballo@mozilla.com
push dateWed, 02 May 2018 21:54:50 +0000
reviewerskats
bugs1458063
milestone61.0a1
Bug 1458063 - Propagate the APZWheelAction to APZCTreeManager. r=kats MozReview-Commit-ID: Kpr7NGLV7J5
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZInputBridge.cpp
widget/InputData.cpp
widget/InputData.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1263,16 +1263,18 @@ APZCTreeManager::ReceiveInputEvent(Input
       FlushRepaintsToClearScreenToGeckoTransform();
 
       ScrollWheelInput& wheelInput = aEvent.AsScrollWheelInput();
       wheelInput.mHandledByAPZ = WillHandleInput(wheelInput);
       if (!wheelInput.mHandledByAPZ) {
         return result;
       }
 
+      MOZ_ASSERT(wheelInput.mAPZAction == APZWheelAction::Scroll);
+
       RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(wheelInput.mOrigin,
                                                             &hitResult);
       if (apzc) {
         MOZ_ASSERT(hitResult != CompositorHitTestInfo::eInvisibleToHitTest);
 
         // For wheel events, the call to ReceiveInputEvent below may result in
         // scrolling, which changes the async transform. However, the event we
         // want to pass to gecko should be the pre-scroll event coordinates,
--- a/gfx/layers/apz/src/APZInputBridge.cpp
+++ b/gfx/layers/apz/src/APZInputBridge.cpp
@@ -139,16 +139,17 @@ APZInputBridge::ReceiveInputEvent(
                                  wheelEvent.mModifiers,
                                  scrollMode,
                                  ScrollWheelInput::DeltaTypeForDeltaMode(
                                                      wheelEvent.mDeltaMode),
                                  origin,
                                  wheelEvent.mDeltaX, wheelEvent.mDeltaY,
                                  wheelEvent.mAllowToOverrideSystemScrollSpeed,
                                  strategy);
+          input.mAPZAction = action.value();
 
           // We add the user multiplier as a separate field, rather than premultiplying
           // it, because if the input is converted back to a WidgetWheelEvent, then
           // EventStateManager would apply the delta a second time. We could in theory
           // work around this by asking ESM to customize the event much sooner, and
           // then save the "mCustomizedByUserPrefs" bit on ScrollWheelInput - but for
           // now, this seems easier.
           EventStateManager::GetUserPrefsForWheelEvent(&wheelEvent,
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -660,16 +660,17 @@ ScrollWheelInput::ScrollWheelInput()
   , mHandledByAPZ(false)
   , mLineOrPageDeltaX(0)
   , mLineOrPageDeltaY(0)
   , mScrollSeriesNumber(0)
   , mUserDeltaMultiplierX(1.0)
   , mUserDeltaMultiplierY(1.0)
   , mMayHaveMomentum(false)
   , mIsMomentum(false)
+  , mAPZAction(APZWheelAction::Scroll)
 {
 }
 
 ScrollWheelInput::ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp,
                                    Modifiers aModifiers, ScrollMode aScrollMode,
                                    ScrollDeltaType aDeltaType,
                                    const ScreenPoint& aOrigin, double aDeltaX,
                                    double aDeltaY,
@@ -687,16 +688,17 @@ ScrollWheelInput::ScrollWheelInput(uint3
   , mLineOrPageDeltaY(0)
   , mScrollSeriesNumber(0)
   , mUserDeltaMultiplierX(1.0)
   , mUserDeltaMultiplierY(1.0)
   , mMayHaveMomentum(false)
   , mIsMomentum(false)
   , mAllowToOverrideSystemScrollSpeed(aAllowToOverrideSystemScrollSpeed)
   , mWheelDeltaAdjustmentStrategy(aWheelDeltaAdjustmentStrategy)
+  , mAPZAction(APZWheelAction::Scroll)
 {
 }
 
 ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent)
   : InputData(SCROLLWHEEL_INPUT, aWheelEvent.mTime, aWheelEvent.mTimeStamp,
               aWheelEvent.mModifiers)
   , mDeltaType(DeltaTypeForDeltaMode(aWheelEvent.mDeltaMode))
   , mScrollMode(SCROLLMODE_INSTANT)
@@ -708,16 +710,17 @@ ScrollWheelInput::ScrollWheelInput(const
   , mScrollSeriesNumber(0)
   , mUserDeltaMultiplierX(1.0)
   , mUserDeltaMultiplierY(1.0)
   , mMayHaveMomentum(aWheelEvent.mMayHaveMomentum)
   , mIsMomentum(aWheelEvent.mIsMomentum)
   , mAllowToOverrideSystemScrollSpeed(
       aWheelEvent.mAllowToOverrideSystemScrollSpeed)
   , mWheelDeltaAdjustmentStrategy(WheelDeltaAdjustmentStrategy::eNone)
+  , mAPZAction(APZWheelAction::Scroll)
 {
   mOrigin =
     ScreenPoint(ViewAs<ScreenPixel>(aWheelEvent.mRefPoint,
       PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
 }
 
 ScrollWheelInput::ScrollDeltaType
 ScrollWheelInput::DeltaTypeForDeltaMode(uint32_t aDeltaMode)
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -11,16 +11,17 @@
 #include "nsPoint.h"
 #include "nsTArray.h"
 #include "Units.h"
 #include "mozilla/DefineEnum.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/WheelHandlingHelper.h"   // for WheelDeltaAdjustmentStrategy
 #include "mozilla/gfx/MatrixFwd.h"
+#include "mozilla/layers/APZUtils.h"
 #include "mozilla/layers/KeyboardScrollAction.h"
 
 template<class E> struct already_AddRefed;
 class nsIWidget;
 
 namespace mozilla {
 
 namespace layers {
@@ -506,16 +507,18 @@ public:
 // with physical scroll wheels, and on Windows by most touchpads when using
 // scroll gestures.
 class ScrollWheelInput : public InputData
 {
 protected:
   friend mozilla::layers::APZInputBridgeChild;
   friend mozilla::layers::PAPZInputBridgeParent;
 
+  typedef mozilla::layers::APZWheelAction APZWheelAction;
+
   ScrollWheelInput();
 
 public:
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     ScrollDeltaType, (
       // There are three kinds of scroll delta modes in Gecko: "page", "line" and
       // "pixel".
       SCROLLDELTA_LINE,
@@ -611,16 +614,18 @@ public:
 
   bool mMayHaveMomentum;
   bool mIsMomentum;
   bool mAllowToOverrideSystemScrollSpeed;
 
   // Sometimes a wheel event input's wheel delta should be adjusted. This member
   // specifies how to adjust the wheel delta.
   WheelDeltaAdjustmentStrategy mWheelDeltaAdjustmentStrategy;
+
+  APZWheelAction mAPZAction;
 };
 
 class KeyboardInput : public InputData
 {
 public:
   typedef mozilla::layers::KeyboardScrollAction KeyboardScrollAction;
 
   // Note that if you change the first member in this enum(I.e. KEY_DOWN) to one