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.
This commit is contained in:
Ting-Yu Lin 2014-11-10 00:29:00 +01:00
Родитель f2cfaf243a
Коммит 892f540142
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

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

Просмотреть файл

@ -227,7 +227,8 @@ private:
DragMode mDragMode;
// True if AsyncPanZoom is enabled
bool mAPZenabled;
bool mAsyncPanZoomEnabled;
bool mEndCaretVisible;
bool mStartCaretVisible;
bool mVisible;