Bug 240933 - Part 10: Only hide/show the caret once when placeholder transactions finish; r=roc a=dbaron

--HG--
extra : rebase_source : dd5c5498ee3cbd115f806ec1e03b3df1d14e4351
This commit is contained in:
Ehsan Akhgari 2010-07-21 16:08:52 -04:00
parent 64b2f04816
commit c91a568174

View File

@ -904,14 +904,27 @@ nsEditor::EndPlaceHolderTransaction()
if (selPrivate) {
selPrivate->SetCanCacheFrameOffset(PR_TRUE);
}
// time to turn off the batch
EndUpdateViewBatch();
// make sure selection is in view
// After ScrollSelectionIntoView(), the pending notifications might be
// flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
ScrollSelectionIntoView(PR_FALSE);
{
// Hide the caret here to avoid hiding it twice, once in EndUpdateViewBatch
// and once in ScrollSelectionIntoView.
nsRefPtr<nsCaret> caret;
nsCOMPtr<nsIPresShell> presShell;
GetPresShell(getter_AddRefs(presShell));
if (presShell)
caret = presShell->GetCaret();
StCaretHider caretHider(caret);
// time to turn off the batch
EndUpdateViewBatch();
// make sure selection is in view
// After ScrollSelectionIntoView(), the pending notifications might be
// flushed and PresShell/PresContext/Frames may be dead. See bug 418470.
ScrollSelectionIntoView(PR_FALSE);
}
// cached for frame offset are Not available now
if (selPrivate) {