From 0b3d49e12b92da60a30a202433b1264adba8e601 Mon Sep 17 00:00:00 2001 From: Morris Tseng Date: Thu, 18 Dec 2014 22:50:00 +0100 Subject: [PATCH] Bug 1109800 - Call CancelLongTapDetector when Selection carets are blurred. r=roc --- dom/base/nsFocusManager.cpp | 13 +++++++------ layout/base/SelectionCarets.cpp | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 12c56d433b64..7a57c0caa98b 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -1614,11 +1614,6 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear, return true; } - nsRefPtr selectionCarets = presShell->GetSelectionCarets(); - if (selectionCarets) { - selectionCarets->NotifyBlur(); - } - bool clearFirstBlurEvent = false; if (!mFirstBlurEvent) { mFirstBlurEvent = content; @@ -1688,8 +1683,14 @@ nsFocusManager::Blur(nsPIDOMWindow* aWindowToClear, // if we are leaving the document or the window was lowered, make the caret // invisible. - if (aIsLeavingDocument || !mActiveWindow) + if (aIsLeavingDocument || !mActiveWindow) { SetCaretVisible(presShell, false, nullptr); + nsRefPtr selectionCarets = presShell->GetSelectionCarets(); + if (selectionCarets) { + selectionCarets->NotifyBlur(); + } + } + // at this point, it is expected that this window will be still be // focused, but the focused content will be null, as it was cleared before diff --git a/layout/base/SelectionCarets.cpp b/layout/base/SelectionCarets.cpp index 429ffebcb3aa..6eaa4331d9ba 100644 --- a/layout/base/SelectionCarets.cpp +++ b/layout/base/SelectionCarets.cpp @@ -1086,6 +1086,7 @@ void SelectionCarets::NotifyBlur() { SetVisibility(false); + CancelLongTapDetector(); DispatchSelectionStateChangedEvent(nullptr, SelectionState::Blur); }