Bug 1273137 - Add the mHandledByAPZ flag to MouseInput as well. r?rbarker draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 07 Jun 2016 11:07:55 -0400
changeset 376277 fa64dcbe31a79412be6fd086a0fa764f792481e1
parent 376276 fde006c4d623b214124fa008cd2366c87f367e45
child 376278 693e5679bf7ffde13717cad291f1f2465e4e6477
push id20521
push userkgupta@mozilla.com
push dateTue, 07 Jun 2016 15:13:57 +0000
reviewersrbarker
bugs1273137
milestone50.0a1
Bug 1273137 - Add the mHandledByAPZ flag to MouseInput as well. r?rbarker MozReview-Commit-ID: EGEzIjvHbml
gfx/layers/apz/src/APZCTreeManager.cpp
widget/InputData.cpp
widget/InputData.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -671,16 +671,17 @@ APZCTreeManager::ReceiveInputEvent(Input
   HitTestResult hitResult = HitNothing;
   switch (aEvent.mInputType) {
     case MULTITOUCH_INPUT: {
       MultiTouchInput& touchInput = aEvent.AsMultiTouchInput();
       result = ProcessTouchInput(touchInput, aOutTargetGuid, aOutInputBlockId);
       break;
     } case MOUSE_INPUT: {
       MouseInput& mouseInput = aEvent.AsMouseInput();
+      mouseInput.mHandledByAPZ = true;
 
       if (DragTracker::StartsDrag(mouseInput)) {
         // If this is the start of a drag we need to unambiguously know if it's
         // going to land on a scrollbar or not. We can't apply an untransform
         // here without knowing that, so we need to ensure the untransform is
         // a no-op.
         FlushRepaintsToClearScreenToGeckoTransform();
       }
@@ -1150,17 +1151,17 @@ APZCTreeManager::ProcessMouseEvent(Widge
 
   MouseInput input(aEvent);
   input.mOrigin = ScreenPoint(aEvent.mRefPoint.x, aEvent.mRefPoint.y);
 
   nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
 
   aEvent.mRefPoint.x = input.mOrigin.x;
   aEvent.mRefPoint.y = input.mOrigin.y;
-  aEvent.mFlags.mHandledByAPZ = true;
+  aEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
   return status;
 }
 
 void
 APZCTreeManager::ProcessTouchVelocity(uint32_t aTimestampMs, float aSpeedY)
 {
   if (mApzcForInputBlock) {
     mApzcForInputBlock->HandleTouchVelocity(aTimestampMs, aSpeedY);
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -29,16 +29,17 @@ already_AddRefed<Touch> SingleTouchData:
 }
 
 MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
   : InputData(MOUSE_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
               aMouseEvent.mModifiers)
   , mType(MOUSE_NONE)
   , mButtonType(NONE)
   , mButtons(aMouseEvent.buttons)
+  , mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "Can only copy from WidgetTouchEvent on main thread");
 
   mButtonType = NONE;
 
   switch (aMouseEvent.button) {
     case WidgetMouseEventBase::eLeftButton:
@@ -153,16 +154,17 @@ MouseInput::ToWidgetMouseEvent(nsIWidget
     default:
       break;
   }
 
   event.buttons = mButtons;
   event.mModifiers = modifiers;
   event.mTime = mTime;
   event.mTimeStamp = mTimeStamp;
+  event.mFlags.mHandledByAPZ = mHandledByAPZ;
   event.mRefPoint =
     RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
       PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
   event.mClickCount = clickCount;
   event.inputSource = mInputSource;
   event.mIgnoreRootScrollFrame = true;
 
   return event;
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -276,39 +276,42 @@ public:
   MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource, int16_t aButtons, const ScreenPoint& aPoint,
              uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers)
     : InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers)
     , mType(aType)
     , mButtonType(aButtonType)
     , mInputSource(aInputSource)
     , mButtons(aButtons)
     , mOrigin(aPoint)
+    , mHandledByAPZ(false)
   {}
 
   MouseInput()
     : InputData(MOUSE_INPUT)
     , mType(MOUSE_NONE)
     , mButtonType(NONE)
     , mInputSource(0)
     , mButtons(0)
+    , mHandledByAPZ(false)
   {}
 
   explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
 
   bool IsLeftButton() const { return mButtonType == LEFT_BUTTON; }
 
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
   WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
 
   MouseType mType;
   ButtonType mButtonType;
   uint16_t mInputSource;
   int16_t mButtons;
   ScreenPoint mOrigin;
   ParentLayerPoint mLocalOrigin;
+  bool mHandledByAPZ;
 };
 
 /**
  * Encapsulation class for pan events, can be used off-main-thread.
  * These events are currently only used for scrolling on desktop.
  */
 class PanGestureInput : public InputData
 {