--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1742,54 +1742,63 @@ TabChild::HandleDoubleTap(const CSSPoint
Stringify(aPoint).c_str(), mGlobal.get(), mTabChildGlobal.get());
if (!mGlobal || !mTabChildGlobal) {
return;
}
// Note: there is nothing to do with the modifiers here, as we are not
// synthesizing any sort of mouse event.
- CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
nsCOMPtr<nsIDocument> document = GetDocument();
- CSSRect zoomToRect = CalculateRectToZoomTo(document, point);
+ CSSRect zoomToRect = CalculateRectToZoomTo(document, aPoint);
// The double-tap can be dispatched by any scroll frame (so |aGuid| could be
// the guid of any scroll frame), but the zoom-to-rect operation must be
// performed by the root content scroll frame, so query its identifiers
// for the SendZoomToRect() call rather than using the ones from |aGuid|.
uint32_t presShellId;
ViewID viewId;
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
document->GetDocumentElement(), &presShellId, &viewId) &&
mAPZChild) {
mAPZChild->SendZoomToRect(presShellId, viewId, zoomToRect,
DEFAULT_BEHAVIOR);
}
}
void
TabChild::HandleTap(GeckoContentController::TapType aType,
- const CSSPoint& aPoint, const Modifiers& aModifiers,
+ const LayoutDevicePoint& aPoint, const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId,
bool aCallTakeFocusForClickFromTap)
{
+ nsCOMPtr<nsIPresShell> presShell = GetPresShell();
+ if (!presShell) {
+ return;
+ }
+ if (!presShell->GetPresContext()) {
+ return;
+ }
+ CSSToLayoutDeviceScale scale(presShell->GetPresContext()->CSSToDevPixelScale());
+ CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint / scale, aGuid);
+
switch (aType) {
case GeckoContentController::TapType::eSingleTap:
if (aCallTakeFocusForClickFromTap && mRemoteFrame) {
mRemoteFrame->SendTakeFocusForClickFromTap();
}
if (mGlobal && mTabChildGlobal) {
- mAPZEventState->ProcessSingleTap(aPoint, aModifiers, aGuid);
+ mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid);
}
break;
case GeckoContentController::TapType::eDoubleTap:
- HandleDoubleTap(aPoint, aModifiers, aGuid);
+ HandleDoubleTap(point, aModifiers, aGuid);
break;
case GeckoContentController::TapType::eLongTap:
if (mGlobal && mTabChildGlobal) {
- mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
+ mAPZEventState->ProcessLongTap(presShell, point, scale, aModifiers, aGuid,
aInputBlockId);
}
break;
case GeckoContentController::TapType::eLongTapUp:
if (mGlobal && mTabChildGlobal) {
mAPZEventState->ProcessLongTapUp();
}
break;
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -618,17 +618,17 @@ public:
const ShowInfo& aShowInfo);
void ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,
bool aPreventDefault) const;
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) const;
void HandleTap(layers::GeckoContentController::TapType aType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
const Modifiers& aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
bool aCallTakeFocusForClickFromTap);
void SetAllowedTouchBehavior(uint64_t aInputBlockId,
const nsTArray<TouchBehaviorFlags>& aFlags) const;
bool UpdateFrame(const FrameMetrics& aFrameMetrics);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1293,19 +1293,19 @@ TabParent::SendRealDragEvent(WidgetDragE
{
if (mIsDestroyed) {
return false;
}
event.mRefPoint += GetChildProcessOffset();
return PBrowserParent::SendRealDragEvent(event, aDragAction, aDropEffect);
}
-CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint)
+LayoutDevicePoint TabParent::AdjustTapToChildWidget(const LayoutDevicePoint& aPoint)
{
- return aPoint + (LayoutDevicePoint(GetChildProcessOffset()) * GetLayoutDeviceToCSSScale());
+ return aPoint + LayoutDevicePoint(GetChildProcessOffset());
}
bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
{
if (mIsDestroyed) {
return false;
}
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -563,17 +563,17 @@ public:
already_AddRefed<nsIWidget> GetWidget() const;
const TabId GetTabId() const
{
return mTabId;
}
LayoutDeviceIntPoint GetChildProcessOffset();
- CSSPoint AdjustTapToChildWidget(const CSSPoint& aPoint);
+ LayoutDevicePoint AdjustTapToChildWidget(const LayoutDevicePoint& aPoint);
/**
* Native widget remoting protocol for use with windowed plugins with e10s.
*/
virtual PPluginWidgetParent* AllocPPluginWidgetParent() override;
virtual bool
DeallocPPluginWidgetParent(PPluginWidgetParent* aActor) override;
--- a/gfx/layers/apz/public/GeckoContentController.h
+++ b/gfx/layers/apz/public/GeckoContentController.h
@@ -50,21 +50,21 @@ public:
eDoubleTap,
eLongTap,
eLongTapUp,
eSentinel,
};
/**
- * Requests handling of a tap event. |aPoint| is in CSS pixels, relative to the
+ * Requests handling of a tap event. |aPoint| is in LD pixels, relative to the
* current scroll offset.
*/
virtual void HandleTap(TapType aType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) = 0;
/**
* Schedules a runnable to run on the controller/UI thread at some time
* in the future.
* This method must always be called on the controller thread.
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1459,37 +1459,31 @@ nsEventStatus AsyncPanZoomController::On
// snap point as appropriate.
ScrollSnap();
}
return nsEventStatus_eConsumeNoDefault;
}
bool
-AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* aOut)
+AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, LayoutDevicePoint* aOut)
{
if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
ScreenToScreenMatrix4x4 transformScreenToGecko =
treeManagerLocal->GetScreenToApzcTransform(this)
* treeManagerLocal->GetApzcToGeckoTransform(this);
Maybe<ScreenIntPoint> layoutPoint = UntransformBy(
transformScreenToGecko, aPoint);
if (!layoutPoint) {
return false;
}
- { // scoped lock to access mFrameMetrics
- ReentrantMonitorAutoEnter lock(mMonitor);
- // NOTE: This isn't *quite* LayoutDevicePoint, we just don't have a name
- // for this coordinate space and it maps the closest to LayoutDevicePoint.
- *aOut = LayoutDevicePoint(ViewAs<LayoutDevicePixel>(*layoutPoint,
- PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent))
- / mFrameMetrics.GetDevPixelsPerCSSPixel();
- }
+ *aOut = LayoutDevicePoint(ViewAs<LayoutDevicePixel>(*layoutPoint,
+ PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
return true;
}
return false;
}
static bool
AllowsScrollingMoreThanOnePage(double aMultiplier)
{
@@ -1983,17 +1977,17 @@ nsEventStatus AsyncPanZoomController::On
return nsEventStatus_eConsumeNoDefault;
}
nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent) {
APZC_LOG("%p got a long-press in state %d\n", this, mState);
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
- CSSPoint geckoScreenPoint;
+ LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
CancelableBlockState* block = CurrentInputBlock();
MOZ_ASSERT(block);
if (!block->AsTouchBlock()) {
APZC_LOG("%p dropping long-press because some non-touch block interrupted it\n", this);
return nsEventStatus_eIgnore;
}
if (block->AsTouchBlock()->IsDuringFastFling()) {
@@ -2012,17 +2006,17 @@ nsEventStatus AsyncPanZoomController::On
APZC_LOG("%p got a long-tap-up in state %d\n", this, mState);
return GenerateSingleTap(TapType::eLongTapUp, aEvent.mPoint, aEvent.modifiers);
}
nsEventStatus AsyncPanZoomController::GenerateSingleTap(TapType aType,
const ScreenIntPoint& aPoint, mozilla::Modifiers aModifiers) {
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
- CSSPoint geckoScreenPoint;
+ LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aPoint, &geckoScreenPoint)) {
CancelableBlockState* block = CurrentInputBlock();
MOZ_ASSERT(block);
TouchBlockState* touch = block->AsTouchBlock();
// |block| may be a non-touch block in the case where this function is
// invoked by GestureEventListener on a timeout. In that case we already
// verified that the single tap is allowed so we let it through.
// XXX there is a bug here that in such a case the touch block that
@@ -2036,17 +2030,17 @@ nsEventStatus AsyncPanZoomController::Ge
touch->SetSingleTapOccurred();
}
// Because this may be being running as part of APZCTreeManager::ReceiveInputEvent,
// calling controller->HandleTap directly might mean that content receives
// the single tap message before the corresponding touch-up. To avoid that we
// schedule the singletap message to run on the next spin of the event loop.
// See bug 965381 for the issue this was causing.
RefPtr<Runnable> runnable =
- NewRunnableMethod<TapType, CSSPoint, mozilla::Modifiers,
+ NewRunnableMethod<TapType, LayoutDevicePoint, mozilla::Modifiers,
ScrollableLayerGuid, uint64_t>(controller,
&GeckoContentController::HandleTap,
aType, geckoScreenPoint,
aModifiers, GetGuid(),
touch ? touch->GetBlockId() : 0);
controller->PostDelayedTask(runnable.forget(), 0);
return nsEventStatus_eConsumeNoDefault;
@@ -2077,17 +2071,17 @@ nsEventStatus AsyncPanZoomController::On
return GenerateSingleTap(TapType::eSingleTap, aEvent.mPoint, aEvent.modifiers);
}
nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent) {
APZC_LOG("%p got a double-tap in state %d\n", this, mState);
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
if (mZoomConstraints.mAllowDoubleTapZoom && CurrentTouchBlock()->TouchActionAllowsDoubleTapZoom()) {
- CSSPoint geckoScreenPoint;
+ LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleTap(TapType::eDoubleTap, geckoScreenPoint,
aEvent.modifiers, GetGuid(), CurrentTouchBlock()->GetBlockId());
}
}
return nsEventStatus_eConsumeNoDefault;
}
return nsEventStatus_eIgnore;
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -603,22 +603,22 @@ protected:
/**
* Gets the pointer to the apzc tree manager. All the access to tree manager
* should be made via this method and not via private variable since this method
* ensures that no lock is set.
*/
APZCTreeManager* GetApzcTreeManager() const;
/**
- * Convert ScreenPoint relative to the screen to CSSPoint relative
+ * Convert ScreenPoint relative to the screen to LayoutDevicePoint relative
* to the parent document. This excludes the transient compositor transform.
- * NOTE: This must be converted to CSSPoint relative to the child
+ * NOTE: This must be converted to LayoutDevicePoint relative to the child
* document before sending over IPC to a child process.
*/
- bool ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* aOut);
+ bool ConvertToGecko(const ScreenIntPoint& aPoint, LayoutDevicePoint* aOut);
enum AxisLockMode {
FREE, /* No locking at all */
STANDARD, /* Default axis locking mode that remains locked until pan ends*/
STICKY, /* Allow lock to be broken, with hysteresis */
};
static AxisLockMode GetAxisLockMode();
--- a/gfx/layers/apz/test/gtest/APZTestCommon.h
+++ b/gfx/layers/apz/test/gtest/APZTestCommon.h
@@ -72,17 +72,17 @@ static TimeStamp GetStartupTime() {
return sStartupTime;
}
class MockContentController : public GeckoContentController {
public:
MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
MOCK_METHOD2(RequestFlingSnap, void(const FrameMetrics::ViewID& aScrollId, const mozilla::CSSPoint& aDestination));
MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration));
- MOCK_METHOD5(HandleTap, void(TapType, const CSSPoint&, Modifiers, const ScrollableLayerGuid&, uint64_t));
+ MOCK_METHOD5(HandleTap, void(TapType, const LayoutDevicePoint&, Modifiers, const ScrollableLayerGuid&, uint64_t));
// Can't use the macros with already_AddRefed :(
void PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) {
RefPtr<Runnable> task = aTask;
}
MOCK_METHOD3(NotifyAPZStateChange, void(const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg));
MOCK_METHOD0(NotifyFlushComplete, void());
};
--- a/gfx/layers/apz/test/gtest/TestEventRegions.cpp
+++ b/gfx/layers/apz/test/gtest/TestEventRegions.cpp
@@ -259,14 +259,14 @@ TEST_F(APZEventRegionsTester, Bug1117712
TestAsyncPanZoomController* apzc2 = ApzcOf(layers[2]);
// These touch events should hit the dispatch-to-content region of layers[3]
// and so get queued with that APZC as the tentative target.
uint64_t inputBlockId = 0;
Tap(manager, ScreenIntPoint(55, 5), TimeDuration::FromMilliseconds(100), nullptr, &inputBlockId);
// But now we tell the APZ that really it hit layers[2], and expect the tap
// to be delivered at the correct coordinates.
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(55, 5), 0, apzc2->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(55, 5), 0, apzc2->GetGuid(), _)).Times(1);
nsTArray<ScrollableLayerGuid> targets;
targets.AppendElement(apzc2->GetGuid());
manager->SetTargetAPZC(inputBlockId, targets);
}
--- a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
+++ b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
@@ -295,17 +295,17 @@ TEST_F(APZCGestureDetectorTester, ShortP
MockFunction<void(std::string checkPointName)> check;
{
InSequence s;
// This verifies that the single tap notification is sent after the
// touchup is fully processed. The ordering here is important.
EXPECT_CALL(check, Call("pre-tap"));
EXPECT_CALL(check, Call("post-tap"));
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
}
check.Call("pre-tap");
TapAndCheckStatus(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(100));
check.Call("post-tap");
apzc->AssertStateIsReset();
}
@@ -315,17 +315,17 @@ TEST_F(APZCGestureDetectorTester, Medium
MockFunction<void(std::string checkPointName)> check;
{
InSequence s;
// This verifies that the single tap notification is sent after the
// touchup is fully processed. The ordering here is important.
EXPECT_CALL(check, Call("pre-tap"));
EXPECT_CALL(check, Call("post-tap"));
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
}
check.Call("pre-tap");
TapAndCheckStatus(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(400));
check.Call("post-tap");
apzc->AssertStateIsReset();
}
@@ -351,21 +351,21 @@ protected:
MockFunction<void(std::string checkPointName)> check;
{
InSequence s;
EXPECT_CALL(check, Call("preHandleLongTap"));
blockId++;
- EXPECT_CALL(*mcc, HandleTap(TapType::eLongTap, CSSPoint(10, 10), 0, apzc->GetGuid(), blockId)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eLongTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), blockId)).Times(1);
EXPECT_CALL(check, Call("postHandleLongTap"));
EXPECT_CALL(check, Call("preHandleLongTapUp"));
- EXPECT_CALL(*mcc, HandleTap(TapType::eLongTapUp, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eLongTapUp, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
EXPECT_CALL(check, Call("postHandleLongTapUp"));
}
// Manually invoke the longpress while the touch is currently down.
check.Call("preHandleLongTap");
mcc->RunThroughDelayedTasks();
check.Call("postHandleLongTap");
@@ -412,17 +412,17 @@ protected:
MockFunction<void(std::string checkPointName)> check;
{
InSequence s;
EXPECT_CALL(check, Call("preHandleLongTap"));
blockId++;
- EXPECT_CALL(*mcc, HandleTap(TapType::eLongTap, CSSPoint(touchX, touchStartY), 0, apzc->GetGuid(), blockId)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eLongTap, LayoutDevicePoint(touchX, touchStartY), 0, apzc->GetGuid(), blockId)).Times(1);
EXPECT_CALL(check, Call("postHandleLongTap"));
}
// Manually invoke the longpress while the touch is currently down.
check.Call("preHandleLongTap");
mcc->RunThroughDelayedTasks();
check.Call("postHandleLongTap");
@@ -434,17 +434,17 @@ protected:
apzc->ContentReceivedInputBlock(blockId, true);
mcc->AdvanceByMillis(1000);
MultiTouchInput mti = CreateMultiTouchInput(MultiTouchInput::MULTITOUCH_MOVE, mcc->Time());
mti.mTouches.AppendElement(SingleTouchData(0, ParentLayerPoint(touchX, touchEndY), ScreenSize(0, 0), 0, 0));
status = apzc->ReceiveInputEvent(mti, nullptr);
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status);
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(touchX, touchEndY), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(touchX, touchEndY), 0, apzc->GetGuid(), _)).Times(0);
status = TouchUp(apzc, ScreenIntPoint(touchX, touchEndY), mcc->Time());
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status);
ParentLayerPoint pointOut;
AsyncTransform viewTransformOut;
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(ParentLayerPoint(), pointOut);
@@ -477,86 +477,86 @@ TEST_F(APZCLongPressTester, LongPressPre
| mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
| mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
}
TEST_F(APZCGestureDetectorTester, DoubleTap) {
MakeApzcWaitForMainThread();
MakeApzcZoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
- EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
uint64_t blockIds[2];
DoubleTapAndCheckStatus(apzc, ScreenIntPoint(10, 10), &blockIds);
// responses to the two touchstarts
apzc->ContentReceivedInputBlock(blockIds[0], false);
apzc->ContentReceivedInputBlock(blockIds[1], false);
apzc->AssertStateIsReset();
}
TEST_F(APZCGestureDetectorTester, DoubleTapNotZoomable) {
MakeApzcWaitForMainThread();
MakeApzcUnzoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(2);
- EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(2);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
uint64_t blockIds[2];
DoubleTapAndCheckStatus(apzc, ScreenIntPoint(10, 10), &blockIds);
// responses to the two touchstarts
apzc->ContentReceivedInputBlock(blockIds[0], false);
apzc->ContentReceivedInputBlock(blockIds[1], false);
apzc->AssertStateIsReset();
}
TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultFirstOnly) {
MakeApzcWaitForMainThread();
MakeApzcZoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
- EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
uint64_t blockIds[2];
DoubleTapAndCheckStatus(apzc, ScreenIntPoint(10, 10), &blockIds);
// responses to the two touchstarts
apzc->ContentReceivedInputBlock(blockIds[0], true);
apzc->ContentReceivedInputBlock(blockIds[1], false);
apzc->AssertStateIsReset();
}
TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultBoth) {
MakeApzcWaitForMainThread();
MakeApzcZoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
- EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(0);
uint64_t blockIds[2];
DoubleTapAndCheckStatus(apzc, ScreenIntPoint(10, 10), &blockIds);
// responses to the two touchstarts
apzc->ContentReceivedInputBlock(blockIds[0], true);
apzc->ContentReceivedInputBlock(blockIds[1], true);
apzc->AssertStateIsReset();
}
// Test for bug 947892
// We test whether we dispatch tap event when the tap is followed by pinch.
TEST_F(APZCGestureDetectorTester, TapFollowedByPinch) {
MakeApzcZoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(100));
int inputId = 0;
MultiTouchInput mti;
mti = CreateMultiTouchInput(MultiTouchInput::MULTITOUCH_START, mcc->Time());
mti.mTouches.AppendElement(SingleTouchData(inputId, ParentLayerPoint(20, 20), ScreenSize(0, 0), 0, 0));
mti.mTouches.AppendElement(SingleTouchData(inputId + 1, ParentLayerPoint(10, 10), ScreenSize(0, 0), 0, 0));
@@ -568,17 +568,17 @@ TEST_F(APZCGestureDetectorTester, TapFol
apzc->ReceiveInputEvent(mti, nullptr);
apzc->AssertStateIsReset();
}
TEST_F(APZCGestureDetectorTester, TapFollowedByMultipleTouches) {
MakeApzcZoomable();
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(100));
int inputId = 0;
MultiTouchInput mti;
mti = CreateMultiTouchInput(MultiTouchInput::MULTITOUCH_START, mcc->Time());
mti.mTouches.AppendElement(SingleTouchData(inputId, ParentLayerPoint(20, 20), ScreenSize(0, 0), 0, 0));
apzc->ReceiveInputEvent(mti, nullptr);
@@ -613,17 +613,17 @@ TEST_F(APZCGestureDetectorTester, LongPr
EXPECT_NE(touchBlockId, wheelBlockId);
mcc->AdvanceByMillis(1000);
}
TEST_F(APZCGestureDetectorTester, TapTimeoutInterruptedByWheel) {
// In this test, even though the wheel block comes right after the tap, the
// tap should still be dispatched because it completes fully before the wheel
// block arrived.
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(10, 10), 0, apzc->GetGuid(), _)).Times(1);
// We make the APZC zoomable so the gesture detector needs to wait to
// distinguish between tap and double-tap. During that timeout is when we
// insert the wheel event.
MakeApzcZoomable();
uint64_t touchBlockId = 0;
uint64_t wheelBlockId = 0;
--- a/gfx/layers/apz/test/gtest/TestHitTesting.cpp
+++ b/gfx/layers/apz/test/gtest/TestHitTesting.cpp
@@ -504,19 +504,19 @@ TEST_F(APZHitTestingTester, TestForceDis
TEST_F(APZHitTestingTester, Bug1148350) {
CreateBug1148350LayerTree();
ScopedLayerTreeRegistration registration(manager, 0, root, mcc);
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
MockFunction<void(std::string checkPointName)> check;
{
InSequence s;
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(100, 100), 0, ApzcOf(layers[1])->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(100, 100), 0, ApzcOf(layers[1])->GetGuid(), _)).Times(1);
EXPECT_CALL(check, Call("Tapped without transform"));
- EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, CSSPoint(100, 100), 0, ApzcOf(layers[1])->GetGuid(), _)).Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, LayoutDevicePoint(100, 100), 0, ApzcOf(layers[1])->GetGuid(), _)).Times(1);
EXPECT_CALL(check, Call("Tapped with interleaved transform"));
}
Tap(manager, ScreenIntPoint(100, 100), TimeDuration::FromMilliseconds(100));
mcc->RunThroughDelayedTasks();
check.Call("Tapped without transform");
uint64_t blockId;
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_tap_fullzoom.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Sanity touch-tapping test with fullzoom</title>
+ <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+ <script type="application/javascript">
+
+function clickButton() {
+ document.addEventListener('click', clicked, false);
+
+ synthesizeNativeTap(document.getElementById('b'), 5, 5, function() {
+ dump("Finished synthesizing tap, waiting for button to be clicked...\n");
+ });
+}
+
+function clicked(e) {
+ is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
+ subtestDone();
+}
+
+SpecialPowers.setFullZoom(window, 2.0);
+waitUntilApzStable().then(clickButton);
+
+ </script>
+</head>
+<body>
+ <button id="b" style="width: 10px; height: 10px; position: relative; top: 100px"></button>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -21,16 +21,17 @@ support-files =
helper_touch_action.html
helper_touch_action_regions.html
helper_scroll_inactive_perspective.html
helper_scroll_inactive_zindex.html
helper_bug1280013.html
helper_tall.html
helper_drag_scroll.html
helper_touch_action_complex.html
+ helper_tap_fullzoom.html
tags = apz
[test_bug982141.html]
[test_bug1151663.html]
[test_bug1277814.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_wheel_scroll.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_wheel_transactions.html]
--- a/gfx/layers/apz/test/mochitest/test_group_touchevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents.html
@@ -37,16 +37,18 @@ touch_action_prefs.push(["layout.css.tou
var subtests = [
// Simple tests to exercise basic panning behaviour
{'file': 'helper_basic_pan.html', 'prefs': basic_pan_prefs},
{'file': 'helper_div_pan.html', 'prefs': basic_pan_prefs},
{'file': 'helper_iframe_pan.html', 'prefs': basic_pan_prefs},
// Simple test to exercise touch-tapping behaviour
{'file': 'helper_tap.html'},
+ // Tapping, but with a full-zoom applied
+ {'file': 'helper_tap_fullzoom.html'},
// For the following two tests, disable displayport suppression to make sure it
// doesn't interfere with the test by scheduling paints non-deterministically.
{'file': 'helper_scrollto_tap.html?true', 'prefs': [["apz.paint_skipping.enabled", true]], 'dp_suppression': false},
{'file': 'helper_scrollto_tap.html?false', 'prefs': [["apz.paint_skipping.enabled", false]], 'dp_suppression': false},
// For the long-tap test, reduce the content response timeout because the touchstart
// event doesn't get processed (because of the event listener) until this expires.
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -161,59 +161,59 @@ private:
Modifiers mModifiers;
nsCOMPtr<nsITimer> mTimer;
};
NS_IMPL_ISUPPORTS(DelayedFireSingleTapEvent, nsITimerCallback)
void
APZEventState::ProcessSingleTap(const CSSPoint& aPoint,
+ const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid)
{
APZES_LOG("Handling single tap at %s on %s with %d\n",
Stringify(aPoint).c_str(), Stringify(aGuid).c_str(), mTouchEndCancelled);
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return;
}
if (mTouchEndCancelled) {
return;
}
- LayoutDevicePoint currentPoint =
- APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid)
- * widget->GetDefaultScale();
+ LayoutDevicePoint ldPoint = aPoint * aScale;
if (!mActiveElementManager->ActiveElementUsesStyle()) {
// If the active element isn't visually affected by the :active style, we
// have no need to wait the extra sActiveDurationMs to make the activation
// visually obvious to the user.
- APZCCallbackHelper::FireSingleTapEvent(currentPoint, aModifiers, widget);
+ APZCCallbackHelper::FireSingleTapEvent(ldPoint, aModifiers, widget);
return;
}
APZES_LOG("Active element uses style, scheduling timer for click event\n");
nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
RefPtr<DelayedFireSingleTapEvent> callback =
- new DelayedFireSingleTapEvent(mWidget, currentPoint, aModifiers, timer);
+ new DelayedFireSingleTapEvent(mWidget, ldPoint, aModifiers, timer);
nsresult rv = timer->InitWithCallback(callback,
sActiveDurationMs,
nsITimer::TYPE_ONE_SHOT);
if (NS_FAILED(rv)) {
// Make |callback| not hold the timer, so they will both be destructed when
// we leave the scope of this function.
callback->ClearTimer();
}
}
void
APZEventState::ProcessLongTap(const nsCOMPtr<nsIPresShell>& aPresShell,
const CSSPoint& aPoint,
+ const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
{
APZES_LOG("Handling long tap at %s\n", Stringify(aPoint).c_str());
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
@@ -221,47 +221,46 @@ APZEventState::ProcessLongTap(const nsCO
}
SendPendingTouchPreventedResponse(false);
// Converting the modifiers to DOM format for the DispatchMouseEvent call
// is the most useless thing ever because nsDOMWindowUtils::SendMouseEvent
// just converts them back to widget format, but that API has many callers,
// including in JS code, so it's not trivial to change.
- CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
bool eventHandled =
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
- point, 2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
+ aPoint, 2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
APZES_LOG("Contextmenu event handled: %d\n", eventHandled);
if (eventHandled) {
// If the contextmenu event was handled then we're showing a contextmenu,
// and so we should remove any activation
mActiveElementManager->ClearActivation();
} else {
// If no one handle context menu, fire MOZLONGTAP event
- LayoutDevicePoint currentPoint = point * widget->GetDefaultScale();
+ LayoutDevicePoint ldPoint = aPoint * aScale;
int time = 0;
nsEventStatus status =
APZCCallbackHelper::DispatchSynthesizedMouseEvent(eMouseLongTap, time,
- currentPoint,
+ ldPoint,
aModifiers, widget);
eventHandled = (status == nsEventStatus_eConsumeNoDefault);
APZES_LOG("MOZLONGTAP event handled: %d\n", eventHandled);
}
mContentReceivedInputBlockCallback(aGuid, aInputBlockId, eventHandled);
if (eventHandled) {
// Also send a touchcancel to content, so that listeners that might be
// waiting for a touchend don't trigger.
WidgetTouchEvent cancelTouchEvent(true, eTouchCancel, widget.get());
cancelTouchEvent.mModifiers = WidgetModifiersToDOMModifiers(aModifiers);
- auto ldPoint = LayoutDeviceIntPoint::Round(point * widget->GetDefaultScale());
+ auto ldPoint = LayoutDeviceIntPoint::Round(point * aScale);
cancelTouchEvent.mTouches.AppendElement(new mozilla::dom::Touch(mLastTouchIdentifier,
ldPoint, LayoutDeviceIntPoint(), 0, 0));
APZCCallbackHelper::DispatchWidgetEvent(cancelTouchEvent);
}
}
void
APZEventState::ProcessLongTapUp()
--- a/gfx/layers/apz/util/APZEventState.h
+++ b/gfx/layers/apz/util/APZEventState.h
@@ -42,20 +42,22 @@ class APZEventState {
typedef FrameMetrics::ViewID ViewID;
public:
APZEventState(nsIWidget* aWidget,
ContentReceivedInputBlockCallback&& aCallback);
NS_INLINE_DECL_REFCOUNTING(APZEventState);
void ProcessSingleTap(const CSSPoint& aPoint,
+ const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid);
void ProcessLongTap(const nsCOMPtr<nsIPresShell>& aUtils,
const CSSPoint& aPoint,
+ const CSSToLayoutDeviceScale& aScale,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId);
void ProcessLongTapUp();
void ProcessTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,
nsEventStatus aApzResponse,
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -120,59 +120,68 @@ ChromeProcessController::HandleDoubleTap
{
MOZ_ASSERT(MessageLoop::current() == mUILoop);
nsCOMPtr<nsIDocument> document = GetRootContentDocument(aGuid.mScrollId);
if (!document.get()) {
return;
}
- CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
// CalculateRectToZoomTo performs a hit test on the frame associated with the
// Root Content Document. Unfortunately that frame does not know about the
// resolution of the document and so we must remove it before calculating
// the zoomToRect.
nsIPresShell* presShell = document->GetShell();
const float resolution = presShell->ScaleToResolution() ? presShell->GetResolution () : 1.0f;
- point.x = point.x / resolution;
- point.y = point.y / resolution;
+ CSSPoint point(aPoint.x / resolution, aPoint.y / resolution);
CSSRect zoomToRect = CalculateRectToZoomTo(document, point);
uint32_t presShellId;
FrameMetrics::ViewID viewId;
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
document->GetDocumentElement(), &presShellId, &viewId)) {
mAPZCTreeManager->ZoomToRect(
ScrollableLayerGuid(aGuid.mLayersId, presShellId, viewId), zoomToRect);
}
}
void
ChromeProcessController::HandleTap(TapType aType,
- const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
+ const mozilla::LayoutDevicePoint& aPoint,
+ Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
{
if (MessageLoop::current() != mUILoop) {
- mUILoop->PostTask(NewRunnableMethod<TapType, mozilla::CSSPoint, Modifiers,
+ mUILoop->PostTask(NewRunnableMethod<TapType, mozilla::LayoutDevicePoint, Modifiers,
ScrollableLayerGuid, uint64_t>(this,
&ChromeProcessController::HandleTap,
aType, aPoint, aModifiers, aGuid, aInputBlockId));
return;
}
+ nsCOMPtr<nsIPresShell> presShell = GetPresShell();
+ if (!presShell) {
+ return;
+ }
+ if (!presShell->GetPresContext()) {
+ return;
+ }
+ CSSToLayoutDeviceScale scale(presShell->GetPresContext()->CSSToDevPixelScale());
+ CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint / scale, aGuid);
+
switch (aType) {
case TapType::eSingleTap:
- mAPZEventState->ProcessSingleTap(aPoint, aModifiers, aGuid);
+ mAPZEventState->ProcessSingleTap(point, scale, aModifiers, aGuid);
break;
case TapType::eDoubleTap:
- HandleDoubleTap(aPoint, aModifiers, aGuid);
+ HandleDoubleTap(point, aModifiers, aGuid);
break;
case TapType::eLongTap:
- mAPZEventState->ProcessLongTap(GetPresShell(), aPoint, aModifiers, aGuid,
+ mAPZEventState->ProcessLongTap(presShell, point, scale, aModifiers, aGuid,
aInputBlockId);
break;
case TapType::eLongTapUp:
mAPZEventState->ProcessLongTapUp();
break;
case TapType::eSentinel:
// Should never happen, but we need to handle this case branch for the
// compiler to be happy.
--- a/gfx/layers/apz/util/ChromeProcessController.h
+++ b/gfx/layers/apz/util/ChromeProcessController.h
@@ -36,17 +36,18 @@ public:
explicit ChromeProcessController(nsIWidget* aWidget, APZEventState* aAPZEventState, IAPZCTreeManager* aAPZCTreeManager);
~ChromeProcessController();
virtual void Destroy() override;
// GeckoContentController interface
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) override;
virtual void PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) override;
virtual void HandleTap(TapType aType,
- const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
+ const mozilla::LayoutDevicePoint& aPoint,
+ Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) override;
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg) override;
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
const nsString& aEvent) override;
virtual void NotifyFlushComplete() override;
--- a/gfx/layers/ipc/APZChild.cpp
+++ b/gfx/layers/ipc/APZChild.cpp
@@ -96,17 +96,17 @@ APZChild::~APZChild()
bool
APZChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{
return mBrowser->UpdateFrame(aFrameMetrics);
}
bool
APZChild::RecvHandleTap(const TapType& aType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aCallTakeFocusForClickFromTap)
{
mBrowser->HandleTap(aType, aPoint, aModifiers, aGuid,
aInputBlockId, aCallTakeFocusForClickFromTap);
return true;
--- a/gfx/layers/ipc/APZChild.h
+++ b/gfx/layers/ipc/APZChild.h
@@ -24,17 +24,17 @@ class APZChild final : public PAPZChild
public:
static APZChild* Create(const dom::TabId& aTabId);
~APZChild();
virtual bool RecvUpdateFrame(const FrameMetrics& frame) override;
virtual bool RecvHandleTap(const TapType& aType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aCallTakeFocusForClickFromTap) override;
virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId,
const APZStateChange& aChange,
const int& aArg) override;
--- a/gfx/layers/ipc/PAPZ.ipdl
+++ b/gfx/layers/ipc/PAPZ.ipdl
@@ -4,17 +4,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include "mozilla/GfxMessageUtils.h";
include protocol PContent;
-using mozilla::CSSPoint from "Units.h";
+using mozilla::LayoutDevicePoint from "Units.h";
using CSSRect from "Units.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
using mozilla::layers::MaybeZoomConstraints from "FrameMetrics.h";
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
@@ -90,17 +90,17 @@ child:
async UpdateFrame(FrameMetrics frame);
// The following methods correspond to functions on the GeckoContentController
// interface in gfx/layers/apz/public/GeckoContentController.h. Refer to documentation
// in that file for these functions.
// The aCallTakeFocusForClickFromTap argument is used for eSingleTap types,
// to request that the child take focus before dispatching the mouse events
// for the tap (otherwise the resulting focus behaviour is incorrect).
- async HandleTap(TapType aType, CSSPoint point, Modifiers aModifiers,
+ async HandleTap(TapType aType, LayoutDevicePoint point, Modifiers aModifiers,
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
bool aCallTakeFocusForClickFromTap);
async NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
async NotifyFlushComplete();
async Destroy();
};
--- a/gfx/layers/ipc/RemoteContentController.cpp
+++ b/gfx/layers/ipc/RemoteContentController.cpp
@@ -49,25 +49,25 @@ RemoteContentController::RequestContentR
MOZ_ASSERT(NS_IsMainThread());
if (CanSend()) {
Unused << SendUpdateFrame(aFrameMetrics);
}
}
void
RemoteContentController::HandleTap(TapType aTapType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
{
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
// thread).
- mUILoop->PostTask(NewRunnableMethod<TapType, CSSPoint, Modifiers,
+ mUILoop->PostTask(NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
ScrollableLayerGuid, uint64_t>(this,
&RemoteContentController::HandleTap,
aTapType, aPoint, aModifiers, aGuid,
aInputBlockId));
return;
}
bool callTakeFocusForClickFromTap = (aTapType == TapType::eSingleTap);
--- a/gfx/layers/ipc/RemoteContentController.h
+++ b/gfx/layers/ipc/RemoteContentController.h
@@ -39,17 +39,17 @@ public:
dom::TabParent* aBrowserParent);
virtual ~RemoteContentController();
// Needs to be called on the main thread.
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) override;
virtual void HandleTap(TapType aTapType,
- const CSSPoint& aPoint,
+ const LayoutDevicePoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId) override;
virtual void PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) override;
virtual bool GetTouchSensitiveRegion(CSSRect* aOutRegion) override;
--- a/widget/android/AndroidContentController.cpp
+++ b/widget/android/AndroidContentController.cpp
@@ -39,35 +39,40 @@ AndroidContentController::NotifyDefaultP
aInputBlockId, aDefaultPrevented), 0);
return;
}
aManager->ContentReceivedInputBlock(aInputBlockId, aDefaultPrevented);
}
void
-AndroidContentController::HandleTap(TapType aType, const CSSPoint& aPoint,
+AndroidContentController::HandleTap(TapType aType, const LayoutDevicePoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId)
{
// This function will get invoked first on the Java UI thread, and then
// again on the main thread (because of the code in ChromeProcessController::
// HandleTap). We want to post the SingleTap message once; it can be
// done from either thread but we need access to the callback transform
// so we do it from the main thread.
if (NS_IsMainThread() && aType == TapType::eSingleTap) {
- CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
-
nsIContent* content = nsLayoutUtils::FindContentFor(aGuid.mScrollId);
nsIPresShell* shell = content
? mozilla::layers::APZCCallbackHelper::GetRootContentDocumentPresShellForContent(content)
: nullptr;
- if (shell && shell->ScaleToResolution()) {
+ if (!shell || !shell->GetPresContext()) {
+ return;
+ }
+
+ CSSPoint point = mozilla::layers::APZCCallbackHelper::ApplyCallbackTransform(
+ aPoint / shell->GetPresContext()->CSSToDevPixelScale(), aGuid);
+
+ if (shell->ScaleToResolution()) {
// We need to convert from the root document to the root content document,
// by unapplying the resolution that's on the content document.
const float resolution = shell->GetResolution();
point.x /= resolution;
point.y /= resolution;
}
CSSIntPoint rounded = RoundedToInt(point);
--- a/widget/android/AndroidContentController.h
+++ b/widget/android/AndroidContentController.h
@@ -29,17 +29,17 @@ public:
mozilla::layers::APZEventState* aAPZEventState,
mozilla::layers::IAPZCTreeManager* aAPZCTreeManager)
: mozilla::layers::ChromeProcessController(aWindow, aAPZEventState, aAPZCTreeManager)
, mAndroidWindow(aWindow)
{}
// ChromeProcessController methods
virtual void Destroy() override;
- void HandleTap(TapType aType, const CSSPoint& aPoint, Modifiers aModifiers,
+ void HandleTap(TapType aType, const LayoutDevicePoint& aPoint, Modifiers aModifiers,
const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) override;
void PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) override;
void UpdateOverscrollVelocity(const float aX, const float aY) override;
void UpdateOverscrollOffset(const float aX, const float aY) override;
void SetScrollingRootContent(const bool isRootContent) override;
void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
APZStateChange aChange,
int aArg) override;