Bug 1108104 part 2 - Move incremental reflow hack from nsSimplePageSequenceFrame::Reflow to nsTableOuterFrame. This is to avoid breaking pages that don't even use tables. r=roc

This commit is contained in:
Mats Palmgren 2014-12-14 17:22:06 +00:00
parent a222d49570
commit 4cad806382
2 changed files with 19 additions and 26 deletions

View File

@ -169,32 +169,6 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE; // we're always complete
// Don't do incremental reflow until we've taught tables how to do
// it right in paginated mode.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// Return our desired size
SetDesiredSize(aDesiredSize, aReflowState, mSize.width, mSize.height);
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
if (GetRect().Width() != aDesiredSize.Width()) {
// Our width is changing; we need to re-center our children (our pages).
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
nsMargin pageCSSMargin = child->GetUsedMargin();
nscoord centeringMargin =
ComputeCenteringMargin(aReflowState.ComputedWidth(),
child->GetRect().width,
pageCSSMargin);
nscoord newX = pageCSSMargin.left + centeringMargin;
// Adjust the child's x-position:
child->MovePositionBy(nsPoint(newX - child->GetNormalPosition().x, 0));
}
}
return;
}
// See if we can get a Print Settings from the Context
if (!mPageData->mPrintSettings &&
aPresContext->Medium() == nsGkAtoms::print) {

View File

@ -1002,6 +1002,25 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
innerRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
}
// Don't do incremental reflow until we've taught tables how to do
// it right in paginated mode.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
aPresContext->IsPaginated() &&
GetNextInFlow()) {
nsIFrame* nif = GetNextInFlow();
bool oc = nif->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER;
NS_MergeReflowStatusInto(&aStatus,
oc ? NS_FRAME_OVERFLOW_INCOMPLETE : NS_FRAME_NOT_COMPLETE);
nsMargin innerMargin = innerRS->ComputedPhysicalMargin();
nsMargin captionMargin;
if (mCaptionFrames.NotEmpty()) {
captionMargin = captionRS->ComputedPhysicalMargin();
}
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, captionMargin);
FinishAndStoreOverflow(&aDesiredSize);
return;
}
// First reflow the caption.
nsHTMLReflowMetrics captionMet(captionRS->GetWritingMode());
nsSize captionSize;