Bug 1140625 - Part 5: Move Flush_Layout to the right place in SelectionCarets::UpdateSelectionCarets. r=roc
authorJeremy Chen <jeremychen@mozilla.com>
Tue, 24 Mar 2015 03:34:00 -0400
changeset 266160 8df7f01875e849df537dc60215b1815f6e2086c9
parent 266159 ce21be83c48b3bcfd6843a19877d300c576c19e5
child 266161 0b63b91de05332fa77abcf72b2b1fd68bda2e0b4
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1140625
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140625 - Part 5: Move Flush_Layout to the right place in SelectionCarets::UpdateSelectionCarets. r=roc
layout/base/SelectionCarets.cpp
--- a/layout/base/SelectionCarets.cpp
+++ b/layout/base/SelectionCarets.cpp
@@ -457,16 +457,18 @@ SelectionCarets::UpdateSelectionCarets()
     SetVisibility(false);
     return;
   }
 
   int32_t rangeCount = selection->RangeCount();
   nsRefPtr<nsRange> firstRange = selection->GetRangeAt(0);
   nsRefPtr<nsRange> lastRange = selection->GetRangeAt(rangeCount - 1);
 
+  mPresShell->FlushPendingNotifications(Flush_Layout);
+
   nsIFrame* rootFrame = mPresShell->GetRootFrame();
 
   if (!rootFrame) {
     SetVisibility(false);
     return;
   }
 
   // Check start and end frame is rtl or ltr text
@@ -490,18 +492,16 @@ SelectionCarets::UpdateSelectionCarets()
   }
 
   // Check if startFrame is after endFrame.
   if (nsLayoutUtils::CompareTreePosition(startFrame, endFrame) > 0) {
     SetVisibility(false);
     return;
   }
 
-  mPresShell->FlushPendingNotifications(Flush_Layout);
-
   // If the selection is not visible, we should dispatch a event.
   nsIFrame* commonAncestorFrame =
     nsLayoutUtils::FindNearestCommonAncestorFrame(startFrame, endFrame);
 
   nsRect selectionRectInRootFrame = nsContentUtils::GetSelectionBoundingRect(selection);
   nsRect selectionRectInCommonAncestorFrame = selectionRectInRootFrame;
   nsLayoutUtils::TransformRect(rootFrame, commonAncestorFrame,
                                selectionRectInCommonAncestorFrame);