Bug 410857 part 2 - DrainOverflowLines before ResolveBidi for slightly improved performance. r=jfkthame draft
authorMats Palmgren <mats@mozilla.com>
Mon, 20 Feb 2017 00:34:13 +0100
changeset 486792 6ec85ae1516a3c77740d58c4932740a03251dad8
parent 486791 b792b86881070735c7c6dc5ab1dfba6c9b057544
child 486793 77439aad6f37ab71d85211d1da6bbcd7c5f137ca
push id46061
push usermpalmgren@mozilla.com
push dateMon, 20 Feb 2017 00:13:17 +0000
reviewersjfkthame
bugs410857
milestone54.0a1
Bug 410857 part 2 - DrainOverflowLines before ResolveBidi for slightly improved performance. r=jfkthame MozReview-Commit-ID: EHVxgv2Jaru
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1158,46 +1158,46 @@ nsBlockFrame::Reflow(nsPresContext*     
   // overflowArea.VisualOverflow().y/yMost invariant, and we may even
   // delete the line with the line cursor.
   ClearLineCursor();
 
   if (IsFrameTreeTooDeep(*reflowInput, aMetrics, aStatus)) {
     return;
   }
 
+#ifdef DEBUG
+  // Between when we drain pushed floats and when we complete reflow,
+  // we're allowed to have multiple continuations of the same float on
+  // our floats list, since a first-in-flow might get pushed to a later
+  // continuation of its containing block.  But it's not permitted
+  // outside that time.
+  nsLayoutUtils::AssertNoDuplicateContinuations(this, mFloats);
+#endif
+
+  // ALWAYS drain overflow. We never want to leave the previnflow's
+  // overflow lines hanging around; block reflow depends on the
+  // overflow line lists being cleared out between reflow passes.
+  DrainOverflowLines();
+
   bool blockStartMarginRoot, blockEndMarginRoot;
   IsMarginRoot(&blockStartMarginRoot, &blockEndMarginRoot);
 
   // Cache the consumed height in the block reflow state so that we don't have
   // to continually recompute it.
   BlockReflowInput state(*reflowInput, aPresContext, this,
                            blockStartMarginRoot, blockEndMarginRoot,
                            needFloatManager, consumedBSize);
 
   if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
     static_cast<nsBlockFrame*>(FirstContinuation())->ResolveBidi();
 
   if (RenumberList()) {
     AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 
-#ifdef DEBUG
-  // Between when we drain pushed floats and when we complete reflow,
-  // we're allowed to have multiple continuations of the same float on
-  // our floats list, since a first-in-flow might get pushed to a later
-  // continuation of its containing block.  But it's not permitted
-  // outside that time.
-  nsLayoutUtils::AssertNoDuplicateContinuations(this, mFloats);
-#endif
-
-  // ALWAYS drain overflow. We never want to leave the previnflow's
-  // overflow lines hanging around; block reflow depends on the
-  // overflow line lists being cleared out between reflow passes.
-  DrainOverflowLines();
-
   // Handle paginated overflow (see nsContainerFrame.h)
   nsOverflowAreas ocBounds;
   nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
   if (GetPrevInFlow()) {
     ReflowOverflowContainerChildren(aPresContext, *reflowInput, ocBounds, 0,
                                     ocStatus);
   }
 
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -1014,17 +1014,19 @@ public:
   /**
    * Returns false if there are no more lines. After this has returned false,
    * don't call any methods on this object again.
    */
   bool Prev();
 
 private:
   friend class nsBlockFrame;
+  friend class nsBidiPresUtils;
   // XXX nsBlockFrame uses this internally in one place.  Try to remove it.
+  // XXX uhm, and nsBidiPresUtils::Resolve too.
   nsBlockInFlowLineIterator(nsBlockFrame* aFrame, LineIterator aLine, bool aInOverflow);
 
   nsBlockFrame* mFrame;
   LineIterator mLine;
   nsLineList* mLineList;  // the line list mLine is in
 
   /**
    * Moves iterator to next valid line reachable from the current block.