Bug 410857 part 2 - DrainOverflowLines before ResolveBidi for slightly improved performance. r=jfkthame
MozReview-Commit-ID: EHVxgv2Jaru
--- 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.