Bug 1547759 - Pass ReflowInput to FinishReflowChild in almost all cases. r=jfkthame

At first glance, it might look like this would change behavior, since
FinishReflowChild passes aReflowInput to DidReflow, which in turn
notifies aReflowInput's mPercentBSizeObserver.  However, if you examine
how the mPercentBSizeObserver is propagated, it can only be set for the
anonymous block wrapping the children of table cells, the children of
table cells, or additionally a child of a table wrapper frame that has
it set (i.e., a table or its caption, when logically a child of a table
cell).  Since all of the frames for which this is being changed are
either internal table elements that are inside of the table, or are
things that can never be a descendant of a table at all, there should be
no change in behavior.

Differential Revision: https://phabricator.services.mozilla.com/D40565

--HG--
extra : moz-landing-system : lando
This commit is contained in:
L. David Baron 2019-08-05 11:52:19 +00:00
Родитель d40bd66226
Коммит c923b062b3
10 изменённых файлов: 34 добавлений и 24 удалений

Просмотреть файл

@ -310,8 +310,8 @@ void ViewportFrame::Reflow(nsPresContext* aPresContext,
ReflowChildFlags::Default, aStatus);
kidBSize = kidDesiredSize.BSize(wm);
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, nullptr, 0, 0,
ReflowChildFlags::Default);
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowInput,
0, 0, ReflowChildFlags::Default);
} else {
kidBSize = LogicalSize(wm, mFrames.FirstChild()->GetSize()).BSize(wm);
}

Просмотреть файл

@ -1027,6 +1027,11 @@ void nsContainerFrame::FinishReflowChild(
const ReflowOutput& aDesiredSize, const ReflowInput* aReflowInput,
const WritingMode& aWM, const LogicalPoint& aPos,
const nsSize& aContainerSize, nsIFrame::ReflowChildFlags aFlags) {
MOZ_ASSERT(!aReflowInput || aReflowInput->mFrame == aKidFrame);
MOZ_ASSERT(aReflowInput || aKidFrame->IsFrameOfType(eMathML) ||
aKidFrame->IsTableCellFrame(),
"aReflowInput should be passed in almost all cases");
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerSize.width != NS_UNCONSTRAINEDSIZE,
"FinishReflowChild with unconstrained container width!");

Просмотреть файл

@ -676,7 +676,7 @@ void nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
// Place and size the child
reflowOutput.Width() = aSize.width;
reflowOutput.Height() = aSize.height;
FinishReflowChild(aChild, aPresContext, reflowOutput, nullptr, aOffset.x,
FinishReflowChild(aChild, aPresContext, reflowOutput, &reflowInput, aOffset.x,
aOffset.y, ReflowChildFlags::Default);
}

Просмотреть файл

@ -257,7 +257,7 @@ void nsPageSequenceFrame::Reflow(nsPresContext* aPresContext,
x += ComputeCenteringMargin(aReflowInput.ComputedWidth(), kidSize.Width(),
pageCSSMargin);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, x, y,
FinishReflowChild(kidFrame, aPresContext, kidSize, &kidReflowInput, x, y,
ReflowChildFlags::Default);
y += kidSize.Height();
y += pageCSSMargin.bottom;

Просмотреть файл

@ -343,7 +343,7 @@ void nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, 0, 0,
ReflowChildFlags::Default, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, 0, 0,
FinishReflowChild(kidFrame, aPresContext, kidSize, &kidReflowInput, 0, 0,
ReflowChildFlags::Default);
}

Просмотреть файл

@ -2674,7 +2674,9 @@ void nsTableFrame::InitChildReflowInput(ReflowInput& aReflowInput) {
// Position and size aKidFrame and update our reflow input. The origin of
// aKidRect is relative to the upper-left origin of our frame
void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
nsIFrame* aKidFrame, nsPoint aKidPosition,
nsIFrame* aKidFrame,
const ReflowInput& aKidReflowInput,
nsPoint aKidPosition,
ReflowOutput& aKidDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow) {
@ -2682,7 +2684,7 @@ void nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
bool isFirstReflow = aKidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
// Place and size the child
FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, nullptr,
FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, &aKidReflowInput,
aKidPosition.x, aKidPosition.y, ReflowChildFlags::Default);
InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow,
@ -2859,7 +2861,7 @@ void nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowInput,
footerStatus);
footerReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
PlaceChild(aReflowInput, aTfoot,
PlaceChild(aReflowInput, aTfoot, footerReflowInput,
// We subtract desiredSize.PhysicalSize() from containerSize here
// to account for the fact that in RTL modes, the origin is
// on the right-hand side so we're not simply converting a
@ -3050,7 +3052,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
if (childX + 1 < rowGroups.Length()) {
nsIFrame* nextRowGroupFrame = rowGroups[childX + 1];
if (nextRowGroupFrame) {
PlaceChild(aReflowInput, kidFrame,
PlaceChild(aReflowInput, kidFrame, kidReflowInput,
kidPosition.GetPhysicalPoint(
wm, containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
@ -3079,7 +3081,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
aLastChildReflowed = prevKidFrame;
break;
} else { // we can't push so lets make clear how much space we need
PlaceChild(aReflowInput, kidFrame,
PlaceChild(aReflowInput, kidFrame, kidReflowInput,
kidPosition.GetPhysicalPoint(
wm, containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
@ -3106,7 +3108,7 @@ void nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
}
// Place the child
PlaceChild(aReflowInput, kidFrame,
PlaceChild(aReflowInput, kidFrame, kidReflowInput,
kidPosition.GetPhysicalPoint(
wm, containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
@ -3196,7 +3198,7 @@ void nsTableFrame::ReflowColGroups(gfxContext* aRenderingContext) {
nsReflowStatus cgStatus;
ReflowChild(kidFrame, presContext, kidMet, kidReflowInput, 0, 0,
ReflowChildFlags::Default, cgStatus);
FinishReflowChild(kidFrame, presContext, kidMet, nullptr, 0, 0,
FinishReflowChild(kidFrame, presContext, kidMet, &kidReflowInput, 0, 0,
ReflowChildFlags::Default);
}
}

Просмотреть файл

@ -661,8 +661,8 @@ class nsTableFrame : public nsContainerFrame {
void DistributeBSizeToRows(const ReflowInput& aReflowInput, nscoord aAmount);
void PlaceChild(TableReflowInput& aReflowInput, nsIFrame* aKidFrame,
nsPoint aKidPosition, ReflowOutput& aKidDesiredSize,
const nsRect& aOriginalKidRect,
const ReflowInput& aKidReflowInput, nsPoint aKidPosition,
ReflowOutput& aKidDesiredSize, const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow);
void PlaceRepeatedFooter(TableReflowInput& aReflowInput,
nsTableRowGroupFrame* aTfoot, nscoord aFooterHeight);

Просмотреть файл

@ -912,8 +912,9 @@ void nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// In vertical-rl mode, we are likely to have containerSize.width = 0
// because ComputedWidth() was NS_UNCONSTRAINEDSIZE.
// For cases where that's wrong, we will fix up the position later.
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr, wm,
kidPosition, containerSize, ReflowChildFlags::Default);
FinishReflowChild(kidFrame, aPresContext, desiredSize,
kidReflowInput.ptrOr(nullptr), wm, kidPosition,
containerSize, ReflowChildFlags::Default);
nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame->IsBorderCollapse()) {

Просмотреть файл

@ -275,14 +275,16 @@ nsIFrame::LogicalSides nsTableRowGroupFrame::GetLogicalSkipSides(
// Position and size aKidFrame and update our reflow input.
void nsTableRowGroupFrame::PlaceChild(
nsPresContext* aPresContext, TableRowGroupReflowInput& aReflowInput,
nsIFrame* aKidFrame, WritingMode aWM, const LogicalPoint& aKidPosition,
const nsSize& aContainerSize, ReflowOutput& aDesiredSize,
const nsRect& aOriginalKidRect, const nsRect& aOriginalKidVisualOverflow) {
nsIFrame* aKidFrame, const ReflowInput& aKidReflowInput, WritingMode aWM,
const LogicalPoint& aKidPosition, const nsSize& aContainerSize,
ReflowOutput& aDesiredSize, const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow) {
bool isFirstReflow = aKidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr, aWM,
aKidPosition, aContainerSize, ReflowChildFlags::Default);
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, &aKidReflowInput,
aWM, aKidPosition, aContainerSize,
ReflowChildFlags::Default);
nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame->IsBorderCollapse()) {
@ -411,8 +413,8 @@ void nsTableRowGroupFrame::ReflowChildren(
kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
// Place the child
PlaceChild(aPresContext, aReflowInput, kidFrame, wm, kidPosition,
containerSize, desiredSize,
PlaceChild(aPresContext, aReflowInput, kidFrame, kidReflowInput, wm,
kidPosition, containerSize, desiredSize,
oldKidRect.GetPhysicalRect(wm, containerSize),
oldKidVisualOverflow);
aReflowInput.bCoord += cellSpacingB;

Просмотреть файл

@ -344,7 +344,7 @@ class nsTableRowGroupFrame final : public nsContainerFrame,
void PlaceChild(nsPresContext* aPresContext,
TableRowGroupReflowInput& aReflowInput, nsIFrame* aKidFrame,
mozilla::WritingMode aWM,
const ReflowInput& aKidReflowInput, mozilla::WritingMode aWM,
const mozilla::LogicalPoint& aKidPosition,
const nsSize& aContainerSize, ReflowOutput& aDesiredSize,
const nsRect& aOriginalKidRect,