From 892f5401429ef38882b2543b5c6f128f4b8b2b9f Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Mon, 10 Nov 2014 00:29:00 +0100 Subject: [PATCH] Bug 1073457 - Launch long tap detector when APZ isn't enabled. f=mtseng, r=roc LaunchLongTapDetector() is used to fire long tap to select word when async pan zoom is not enabled. We should check if async pan zoom is enabled rather than check whether it's on main process. This can also fix selection carets not working on e10s. --- layout/base/SelectionCarets.cpp | 14 +++++++------- layout/base/SelectionCarets.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/layout/base/SelectionCarets.cpp b/layout/base/SelectionCarets.cpp index 6c6437b81928..d4d4ae616acc 100644 --- a/layout/base/SelectionCarets.cpp +++ b/layout/base/SelectionCarets.cpp @@ -83,7 +83,7 @@ SelectionCarets::SelectionCarets(nsIPresShell* aPresShell) , mActiveTouchId(-1) , mCaretCenterToDownPointOffsetY(0) , mDragMode(NONE) - , mAPZenabled(false) + , mAsyncPanZoomEnabled(false) , mEndCaretVisible(false) , mStartCaretVisible(false) , mVisible(false) @@ -119,6 +119,9 @@ SelectionCarets::Init() return; } + docShell->GetAsyncPanZoomEnabled(&mAsyncPanZoomEnabled); + mAsyncPanZoomEnabled = mAsyncPanZoomEnabled && gfxPrefs::AsyncPanZoomEnabled(); + docShell->AddWeakReflowObserver(this); docShell->AddWeakScrollObserver(this); } @@ -1014,9 +1017,6 @@ DispatchScrollViewChangeEvent(nsIPresShell *aPresShell, const dom::ScrollState a void SelectionCarets::AsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos) { - // Receives the notifications from AsyncPanZoom, sets mAPZenabled as true here - // to bypass the notifications from ScrollPositionChanged callbacks - mAPZenabled = true; SetVisibility(false); SELECTIONCARETS_LOG("Dispatch scroll started with position x=%d, y=%d", @@ -1037,7 +1037,7 @@ SelectionCarets::AsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos) void SelectionCarets::ScrollPositionChanged() { - if (!mAPZenabled && mVisible) { + if (!mAsyncPanZoomEnabled && mVisible) { SetVisibility(false); //TODO: handling scrolling for selection bubble when APZ is off @@ -1049,7 +1049,7 @@ SelectionCarets::ScrollPositionChanged() void SelectionCarets::LaunchLongTapDetector() { - if (XRE_GetProcessType() != GeckoProcessType_Default) { + if (mAsyncPanZoomEnabled) { return; } @@ -1071,7 +1071,7 @@ SelectionCarets::LaunchLongTapDetector() void SelectionCarets::CancelLongTapDetector() { - if (XRE_GetProcessType() != GeckoProcessType_Default) { + if (mAsyncPanZoomEnabled) { return; } diff --git a/layout/base/SelectionCarets.h b/layout/base/SelectionCarets.h index 109e2a223948..d6a9e475f8ff 100644 --- a/layout/base/SelectionCarets.h +++ b/layout/base/SelectionCarets.h @@ -227,7 +227,8 @@ private: DragMode mDragMode; // True if AsyncPanZoom is enabled - bool mAPZenabled; + bool mAsyncPanZoomEnabled; + bool mEndCaretVisible; bool mStartCaretVisible; bool mVisible;