diff --git a/layout/base/SelectionCarets.cpp b/layout/base/SelectionCarets.cpp index f59928fc9a8d..242af5edb496 100644 --- a/layout/base/SelectionCarets.cpp +++ b/layout/base/SelectionCarets.cpp @@ -462,6 +462,8 @@ SelectionCarets::UpdateSelectionCarets() nsRefPtr firstRange = selection->GetRangeAt(0); nsRefPtr lastRange = selection->GetRangeAt(rangeCount - 1); + mPresShell->FlushPendingNotifications(Flush_Layout); + nsIFrame* rootFrame = mPresShell->GetRootFrame(); if (!rootFrame) { @@ -495,8 +497,6 @@ SelectionCarets::UpdateSelectionCarets() return; } - mPresShell->FlushPendingNotifications(Flush_Layout); - // If the selection is not visible, we should dispatch a event. nsIFrame* commonAncestorFrame = nsLayoutUtils::FindNearestCommonAncestorFrame(startFrame, endFrame);