From 785ffc0d50444118f2b63d612d6387b097eef964 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Tue, 28 Oct 2014 06:01:00 +0100 Subject: [PATCH] Bug 1059165 - Part 1 - Always sync visibility for touch caret. r=ehsan We should sync touch caret's visibility with caret every time since touch caret might be hidden due to timeout while caret is enabled. Also remove dead code. --- layout/base/nsPresShell.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index a8339b93be1d..94effa87d6ad 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2224,19 +2224,16 @@ NS_IMETHODIMP PresShell::SetCaretEnabled(bool aInEnable) if (mCaretEnabled != oldEnabled) { -/* Don't change the caret's selection here! This was an evil side-effect of SetCaretEnabled() - nsCOMPtr domSel; - if (NS_SUCCEEDED(GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel))) && domSel) - mCaret->SetCaretDOMSelection(domSel); -*/ - - MOZ_ASSERT(mCaret || mTouchCaret); + MOZ_ASSERT(mCaret); if (mCaret) { mCaret->SetVisible(mCaretEnabled); } - if (mTouchCaret) { - mTouchCaret->SyncVisibilityWithCaret(); - } + } + + // We should sync touch caret's visibility with caret every time since touch + // caret might be hidden due to timeout while caret is enabled. + if (mTouchCaret) { + mTouchCaret->SyncVisibilityWithCaret(); } return NS_OK;