diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index a9730661432..539db60b1c5 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -995,7 +995,7 @@ TabParent::AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScr } void TabParent::HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid &aGuid) { if (!mIsDestroyed) { @@ -1004,7 +1004,7 @@ void TabParent::HandleDoubleTap(const CSSPoint& aPoint, } void TabParent::HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid &aGuid) { // TODO Send the modifier data to TabChild for use in mouse events. @@ -1014,7 +1014,7 @@ void TabParent::HandleSingleTap(const CSSPoint& aPoint, } void TabParent::HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid &aGuid, uint64_t aInputBlockId) { @@ -1024,7 +1024,7 @@ void TabParent::HandleLongTap(const CSSPoint& aPoint, } void TabParent::HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid &aGuid) { if (!mIsDestroyed) { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 461dde7a5d4..c23e67e3189 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -251,17 +251,17 @@ public: void UIResolutionChanged(); void AcknowledgeScrollUpdate(const ViewID& aScrollId, const uint32_t& aScrollGeneration); void HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid); void HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid); void HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); void HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid); void NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, diff --git a/gfx/layers/apz/public/GeckoContentController.h b/gfx/layers/apz/public/GeckoContentController.h index c7bf03ea8bd..c479236e766 100644 --- a/gfx/layers/apz/public/GeckoContentController.h +++ b/gfx/layers/apz/public/GeckoContentController.h @@ -10,6 +10,7 @@ #include "FrameMetrics.h" // for FrameMetrics, etc #include "Units.h" // for CSSPoint, CSSRect, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "mozilla/EventForwards.h" // for Modifiers #include "nsISupportsImpl.h" class Task; @@ -44,7 +45,7 @@ public: * to. */ virtual void HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) = 0; /** @@ -53,7 +54,7 @@ public: * button down, then mouse button up at |aPoint|. */ virtual void HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) = 0; /** @@ -61,7 +62,7 @@ public: * current scroll offset. */ virtual void HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) = 0; @@ -74,7 +75,7 @@ public: * notifies the APZ that the long-tap event was prevent-defaulted). */ virtual void HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) = 0; /** diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index d7ca82c0465..d78b636d11e 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -84,57 +84,6 @@ # define APZC_LOG_FM(fm, prefix, ...) #endif -// Static helper functions -namespace { - -int32_t -WidgetModifiersToDOMModifiers(mozilla::Modifiers aModifiers) -{ - int32_t result = 0; - if (aModifiers & mozilla::MODIFIER_SHIFT) { - result |= nsIDOMWindowUtils::MODIFIER_SHIFT; - } - if (aModifiers & mozilla::MODIFIER_CONTROL) { - result |= nsIDOMWindowUtils::MODIFIER_CONTROL; - } - if (aModifiers & mozilla::MODIFIER_ALT) { - result |= nsIDOMWindowUtils::MODIFIER_ALT; - } - if (aModifiers & mozilla::MODIFIER_META) { - result |= nsIDOMWindowUtils::MODIFIER_META; - } - if (aModifiers & mozilla::MODIFIER_ALTGRAPH) { - result |= nsIDOMWindowUtils::MODIFIER_ALTGRAPH; - } - if (aModifiers & mozilla::MODIFIER_CAPSLOCK) { - result |= nsIDOMWindowUtils::MODIFIER_CAPSLOCK; - } - if (aModifiers & mozilla::MODIFIER_FN) { - result |= nsIDOMWindowUtils::MODIFIER_FN; - } - if (aModifiers & mozilla::MODIFIER_FNLOCK) { - result |= nsIDOMWindowUtils::MODIFIER_FNLOCK; - } - if (aModifiers & mozilla::MODIFIER_NUMLOCK) { - result |= nsIDOMWindowUtils::MODIFIER_NUMLOCK; - } - if (aModifiers & mozilla::MODIFIER_SCROLLLOCK) { - result |= nsIDOMWindowUtils::MODIFIER_SCROLLLOCK; - } - if (aModifiers & mozilla::MODIFIER_SYMBOL) { - result |= nsIDOMWindowUtils::MODIFIER_SYMBOL; - } - if (aModifiers & mozilla::MODIFIER_SYMBOLLOCK) { - result |= nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK; - } - if (aModifiers & mozilla::MODIFIER_OS) { - result |= nsIDOMWindowUtils::MODIFIER_OS; - } - return result; -} - -} - namespace mozilla { namespace layers { @@ -1653,7 +1602,6 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent) APZC_LOG("%p got a long-press in state %d\n", this, mState); nsRefPtr controller = GetGeckoContentController(); if (controller) { - int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers); CSSPoint geckoScreenPoint; if (ConvertToGecko(aEvent.mLocalPoint, &geckoScreenPoint)) { if (CurrentTouchBlock()->IsDuringFastMotion()) { @@ -1661,7 +1609,7 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent) return nsEventStatus_eIgnore; } uint64_t blockId = GetInputQueue()->InjectNewTouchBlock(this); - controller->HandleLongTap(geckoScreenPoint, modifiers, GetGuid(), blockId); + controller->HandleLongTap(geckoScreenPoint, aEvent.modifiers, GetGuid(), blockId); return nsEventStatus_eConsumeNoDefault; } } @@ -1672,10 +1620,9 @@ nsEventStatus AsyncPanZoomController::OnLongPressUp(const TapGestureInput& aEven APZC_LOG("%p got a long-tap-up in state %d\n", this, mState); nsRefPtr controller = GetGeckoContentController(); if (controller) { - int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers); CSSPoint geckoScreenPoint; if (ConvertToGecko(aEvent.mLocalPoint, &geckoScreenPoint)) { - controller->HandleLongTapUp(geckoScreenPoint, modifiers, GetGuid()); + controller->HandleLongTapUp(geckoScreenPoint, aEvent.modifiers, GetGuid()); return nsEventStatus_eConsumeNoDefault; } } @@ -1697,7 +1644,7 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(const ParentLayerPoint& // See bug 965381 for the issue this was causing. controller->PostDelayedTask( NewRunnableMethod(controller.get(), &GeckoContentController::HandleSingleTap, - geckoScreenPoint, WidgetModifiersToDOMModifiers(aModifiers), + geckoScreenPoint, aModifiers, GetGuid()), 0); return nsEventStatus_eConsumeNoDefault; @@ -1733,10 +1680,9 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent) nsRefPtr controller = GetGeckoContentController(); if (controller) { if (mZoomConstraints.mAllowDoubleTapZoom && CurrentTouchBlock()->TouchActionAllowsDoubleTapZoom()) { - int32_t modifiers = WidgetModifiersToDOMModifiers(aEvent.modifiers); CSSPoint geckoScreenPoint; if (ConvertToGecko(aEvent.mLocalPoint, &geckoScreenPoint)) { - controller->HandleDoubleTap(geckoScreenPoint, modifiers, GetGuid()); + controller->HandleDoubleTap(geckoScreenPoint, aEvent.modifiers, GetGuid()); } } return nsEventStatus_eConsumeNoDefault; diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index 3c33bc3eb7a..57c0839c6a9 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -129,7 +129,7 @@ ChromeProcessController::GetDOMWindowUtils() const void ChromeProcessController::HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) { if (MessageLoop::current() != mUILoop) { @@ -144,7 +144,7 @@ ChromeProcessController::HandleSingleTap(const CSSPoint& aPoint, } void -ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, +ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) { @@ -161,7 +161,7 @@ ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t } void -ChromeProcessController::HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers, +ChromeProcessController::HandleLongTapUp(const CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid) { if (MessageLoop::current() != mUILoop) { diff --git a/gfx/layers/apz/util/ChromeProcessController.h b/gfx/layers/apz/util/ChromeProcessController.h index ee91ec6506e..0fc8ec5bfd9 100644 --- a/gfx/layers/apz/util/ChromeProcessController.h +++ b/gfx/layers/apz/util/ChromeProcessController.h @@ -40,14 +40,14 @@ public: virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration) MOZ_OVERRIDE; - virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {} - virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; - virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) MOZ_OVERRIDE; - virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers, + virtual void HandleLongTapUp(const CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {} diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 7a75f3b7c4d..776e33c874d 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -62,10 +62,10 @@ class MockContentController : public GeckoContentController { public: MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&)); MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration)); - MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&)); - MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&)); - MOCK_METHOD4(HandleLongTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&, uint64_t)); - MOCK_METHOD3(HandleLongTapUp, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&)); + MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); + MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); + MOCK_METHOD4(HandleLongTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&, uint64_t)); + MOCK_METHOD3(HandleLongTapUp, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); MOCK_METHOD3(SendAsyncScrollDOMEvent, void(bool aIsRoot, const CSSRect &aContentRect, const CSSSize &aScrollableSize)); MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs)); MOCK_METHOD3(NotifyAPZStateChange, void(const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg)); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 22cfc651735..d0d97b6310c 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -13,6 +13,7 @@ # include "LayerManagerD3D9.h" #endif //MOZ_ENABLE_D3D9_LAYER #include "mozilla/BrowserElementParent.h" +#include "mozilla/EventForwards.h" // for Modifiers #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/TabParent.h" #include "mozilla/layers/APZCTreeManager.h" @@ -119,7 +120,7 @@ public: } virtual void HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE { if (MessageLoop::current() != mUILoop) { @@ -138,7 +139,7 @@ public: } virtual void HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE { if (MessageLoop::current() != mUILoop) { @@ -158,7 +159,7 @@ public: } virtual void HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) MOZ_OVERRIDE { @@ -178,7 +179,7 @@ public: } virtual void HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE { if (MessageLoop::current() != mUILoop) { diff --git a/widget/android/APZCCallbackHandler.cpp b/widget/android/APZCCallbackHandler.cpp index 8c4b52ef8f8..66823aa91c3 100644 --- a/widget/android/APZCCallbackHandler.cpp +++ b/widget/android/APZCCallbackHandler.cpp @@ -111,7 +111,7 @@ APZCCallbackHandler::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScroll void APZCCallbackHandler::HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) { CSSIntPoint point = RoundedToInt(aPoint); @@ -122,7 +122,7 @@ APZCCallbackHandler::HandleDoubleTap(const CSSPoint& aPoint, void APZCCallbackHandler::HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) { // FIXME Send the modifier data to Gecko for use in mouse events. @@ -134,7 +134,7 @@ APZCCallbackHandler::HandleSingleTap(const CSSPoint& aPoint, void APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) { @@ -147,7 +147,7 @@ APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint, void APZCCallbackHandler::HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) { HandleSingleTap(aPoint, aModifiers, aGuid); diff --git a/widget/android/APZCCallbackHandler.h b/widget/android/APZCCallbackHandler.h index df5ccff4954..0aa1f98a30b 100644 --- a/widget/android/APZCCallbackHandler.h +++ b/widget/android/APZCCallbackHandler.h @@ -7,6 +7,7 @@ #define APZCCallbackHandler_h__ #include "mozilla/layers/GeckoContentController.h" +#include "mozilla/EventForwards.h" // for Modifiers #include "mozilla/StaticPtr.h" #include "mozilla/TimeStamp.h" #include "GeneratedJNIWrappers.h" @@ -45,14 +46,14 @@ public: // GeckoContentController methods void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE; void AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration) MOZ_OVERRIDE; - void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + void HandleDoubleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; - void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + void HandleSingleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; - void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) MOZ_OVERRIDE; - void HandleLongTapUp(const mozilla::CSSPoint& aPoint, int32_t aModifiers, + void HandleLongTapUp(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect& aContentRect, const mozilla::CSSSize& aScrollableSize) MOZ_OVERRIDE; diff --git a/widget/windows/winrt/APZController.cpp b/widget/windows/winrt/APZController.cpp index fff957127c6..3b7c1a2c22f 100644 --- a/widget/windows/winrt/APZController.cpp +++ b/widget/windows/winrt/APZController.cpp @@ -200,21 +200,21 @@ APZController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, void APZController::HandleDoubleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) { } void APZController::HandleSingleTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) { } void APZController::HandleLongTap(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) { @@ -226,7 +226,7 @@ APZController::HandleLongTap(const CSSPoint& aPoint, void APZController::HandleLongTapUp(const CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const ScrollableLayerGuid& aGuid) { } diff --git a/widget/windows/winrt/APZController.h b/widget/windows/winrt/APZController.h index 3d1cbe24b54..93d4f9d5f7e 100644 --- a/widget/windows/winrt/APZController.h +++ b/widget/windows/winrt/APZController.h @@ -39,17 +39,17 @@ public: virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics); virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId, const uint32_t& aScrollGeneration); virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid); virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid); virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); virtual void HandleLongTapUp(const mozilla::CSSPoint& aPoint, - int32_t aModifiers, + Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid); virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize); virtual void PostDelayedTask(Task* aTask, int aDelayMs);