Bug 1055865 patch 2 - Use separate nsHTMLReflowMetrics for reflowing the child of the nsFirstLetterFrame. r=jfkthame
authorL. David Baron <dbaron@dbaron.org>
Mon, 25 Aug 2014 15:32:03 -0700
changeset 223212 a25c36bd68f938f209c3d29f176f6169cc08ccec
parent 223211 86f8442355cffb720d5103b305dff2e54d35f2f1
child 223213 1e5f9b3a220ef5340d539383935301a2adbd14fd
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1055865
milestone34.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 1055865 patch 2 - Use separate nsHTMLReflowMetrics for reflowing the child of the nsFirstLetterFrame. r=jfkthame This changes this code to do things in the normal way, which is to use a separate nsHTMLReflowMetrics for each Reflow, rather than (as this code was) reusing the one for the nsFirstLetterFrame for its text frame child.
layout/generic/nsFirstLetterFrame.cpp
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -179,16 +179,19 @@ nsFirstLetterFrame::Reflow(nsPresContext
   const LogicalMargin& bp = aReflowState.ComputedLogicalBorderPadding();
   NS_ASSERTION(availSize.ISize(wm) != NS_UNCONSTRAINEDSIZE,
                "should no longer use unconstrained inline size");
   availSize.ISize(wm) -= bp.IStartEnd(wm);
   if (NS_UNCONSTRAINEDSIZE != availSize.BSize(wm)) {
     availSize.BSize(wm) -= bp.BStartEnd(wm);
   }
 
+  WritingMode lineWM = aMetrics.GetWritingMode();
+  nsHTMLReflowMetrics kidMetrics(lineWM);
+
   // Reflow the child
   if (!aReflowState.mLineLayout) {
     // When there is no lineLayout provided, we provide our own. The
     // only time that the first-letter-frame is not reflowing in a
     // line context is when its floating.
     WritingMode kidWritingMode = GetWritingMode(kid);
     LogicalSize kidAvailSize = availSize.ConvertTo(kidWritingMode, wm);
     nsHTMLReflowState rs(aPresContext, aReflowState, kid, kidAvailSize);
@@ -198,51 +201,50 @@ nsFirstLetterFrame::Reflow(nsPresContext
                        availSize.ISize(wm), NS_UNCONSTRAINEDSIZE,
                        false, true, kidWritingMode,
                        aReflowState.AvailableWidth());
     rs.mLineLayout = &ll;
     ll.SetInFirstLetter(true);
     ll.SetFirstLetterStyleOK(true);
 
     kid->WillReflow(aPresContext);
-    kid->Reflow(aPresContext, aMetrics, rs, aReflowStatus);
+    kid->Reflow(aPresContext, kidMetrics, rs, aReflowStatus);
 
     ll.EndLineReflow();
     ll.SetInFirstLetter(false);
 
     // In the floating first-letter case, we need to set this ourselves;
     // nsLineLayout::BeginSpan will set it in the other case
-    mBaseline = aMetrics.BlockStartAscent();
+    mBaseline = kidMetrics.BlockStartAscent();
   }
   else {
     // Pretend we are a span and reflow the child frame
     nsLineLayout* ll = aReflowState.mLineLayout;
     bool          pushedFrame;
 
     ll->SetInFirstLetter(
       mStyleContext->GetPseudo() == nsCSSPseudoElements::firstLetter);
     ll->BeginSpan(this, &aReflowState, bp.IStart(wm),
                   availSize.ISize(wm), &mBaseline);
-    ll->ReflowFrame(kid, aReflowStatus, &aMetrics, pushedFrame);
+    ll->ReflowFrame(kid, aReflowStatus, &kidMetrics, pushedFrame);
     ll->EndSpan(this);
     ll->SetInFirstLetter(false);
   }
 
   // Place and size the child and update the output metrics
-  WritingMode lineWM = aMetrics.GetWritingMode();
-  LogicalSize convertedSize = aMetrics.Size(lineWM).ConvertTo(wm, lineWM);
+  LogicalSize convertedSize = kidMetrics.Size(lineWM).ConvertTo(wm, lineWM);
   kid->SetRect(nsRect(bp.IStart(wm), bp.BStart(wm),
                       convertedSize.ISize(wm), convertedSize.BSize(wm)));
-  kid->FinishAndStoreOverflow(&aMetrics);
+  kid->FinishAndStoreOverflow(&kidMetrics);
   kid->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
 
   convertedSize.ISize(wm) += bp.IStartEnd(wm);
   convertedSize.BSize(wm) += bp.BStartEnd(wm);
   aMetrics.SetSize(wm, convertedSize);
-  aMetrics.SetBlockStartAscent(aMetrics.BlockStartAscent() +
+  aMetrics.SetBlockStartAscent(kidMetrics.BlockStartAscent() +
                                bp.BStart(wm));
 
   // Ensure that the overflow rect contains the child textframe's overflow rect.
   // Note that if this is floating, the overline/underline drawable area is in
   // the overflow rect of the child textframe.
   aMetrics.UnionOverflowAreasWithDesiredBounds();
   ConsiderChildOverflow(aMetrics.mOverflowAreas, kid);