Bug 943537 - In the GeckoContentController interface, take the modifiers for tap events in 'widget modifier' format rather than 'DOM modifier' format. r=kats,mbrubeck

This commit is contained in:
Botond Ballo 2015-03-02 16:38:07 -05:00
parent f37caf573f
commit 27f1fc4347
12 changed files with 50 additions and 101 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -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;
/**

View File

@ -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<GeckoContentController> 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<GeckoContentController> 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<GeckoContentController> 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;

View File

@ -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) {

View File

@ -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 {}

View File

@ -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));

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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);