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;