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.
This commit is contained in:
L. David Baron 2014-08-25 15:32:03 -07:00
parent 61d5c425b8
commit 09267bcbdd

View File

@ -184,6 +184,9 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
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
@ -203,14 +206,14 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
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
@ -221,23 +224,22 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
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.