Issue #1916 - Part 1: Convert flags passed to ReflowChild, FinishReflowChild, etc into an enum class.

Backported from Mozilla bug 1571250.
This commit is contained in:
Job Bautista 2022-06-17 16:05:57 +08:00 committed by roytam1
commit 0423d83560
51 changed files with 365 additions and 303 deletions

View file

@ -640,7 +640,8 @@ void nsTableCellFrame::BlockDirAlignChild(WritingMode aWM, nscoord aMaxAscent)
if (HasView()) {
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this,
GetView(),
desiredSize.VisualOverflow(), 0);
desiredSize.VisualOverflow(),
ReflowChildFlags::Default);
}
}
@ -937,8 +938,8 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
nsRect origVisualOverflow = firstKid->GetVisualOverflowRect();
bool firstReflow = firstKid->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
ReflowChild(firstKid, aPresContext, kidSize, kidReflowInput,
wm, kidOrigin, containerSize, 0, aStatus);
ReflowChild(firstKid, aPresContext, kidSize, kidReflowInput, wm, kidOrigin,
containerSize, ReflowChildFlags::Default, aStatus);
if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus)) {
// Don't pass OVERFLOW_INCOMPLETE through tables until they can actually handle it
//XXX should paginate overflow as overflow, but not in this patch (bug 379349)
@ -967,8 +968,8 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
SetContentEmpty(isEmpty);
// Place the child
FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowInput,
wm, kidOrigin, containerSize, 0);
FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowInput, wm,
kidOrigin, containerSize, ReflowChildFlags::Default);
nsTableFrame::InvalidateTableFrame(firstKid, origRect, origVisualOverflow,
firstReflow);

View file

@ -374,8 +374,10 @@ nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
LogicalSize(kidFrame->GetWritingMode()));
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, 0, 0, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, 0, 0, 0);
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, 0, 0,
ReflowChildFlags::Default, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, 0, 0,
ReflowChildFlags::Default);
}
aDesiredSize.ClearSize();

View file

@ -103,13 +103,13 @@ struct TableReflowInput {
availSize.BSize(wm) = std::max(0, availSize.BSize(wm));
}
}
void ReduceAvailableBSizeBy(WritingMode aWM, nscoord aAmount) {
if (availSize.BSize(aWM) == NS_UNCONSTRAINEDSIZE) {
return;
}
availSize.BSize(aWM) -= aAmount;
availSize.BSize(aWM) = std::max(0, availSize.BSize(aWM));
void ReduceAvailableBSizeBy(WritingMode aWM, nscoord aAmount) {
if (availSize.BSize(aWM) == NS_UNCONSTRAINEDSIZE) {
return;
}
availSize.BSize(aWM) -= aAmount;
availSize.BSize(aWM) = std::max(0, availSize.BSize(aWM));
}
};
@ -2680,7 +2680,7 @@ nsTableFrame::PlaceChild(TableReflowInput& aReflowInput,
// Place and size the child
FinishReflowChild(aKidFrame, PresContext(), aKidDesiredSize, nullptr,
aKidPosition.x, aKidPosition.y, 0);
aKidPosition.x, aKidPosition.y, ReflowChildFlags::Default);
InvalidateTableFrame(aKidFrame, aOriginalKidRect, aOriginalKidVisualOverflow,
isFirstReflow);
@ -2832,9 +2832,9 @@ nsTableFrame::SetupHeaderFooterChild(const TableReflowInput& aReflowInput,
ReflowOutput desiredSize(aReflowInput.reflowInput);
desiredSize.ClearSize();
nsReflowStatus status;
ReflowChild(aFrame, presContext, desiredSize, kidReflowInput,
wm, LogicalPoint(wm, aReflowInput.iCoord, aReflowInput.bCoord),
containerSize, 0, status);
ReflowChild(aFrame, presContext, desiredSize, kidReflowInput, wm,
LogicalPoint(wm, aReflowInput.iCoord, aReflowInput.bCoord),
containerSize, ReflowChildFlags::Default, status);
// The child will be reflowed again "for real" so no need to place it now
aFrame->SetRepeatable(IsRepeatable(desiredSize.Height(), pageHeight));
@ -2870,8 +2870,9 @@ nsTableFrame::PlaceRepeatedFooter(TableReflowInput& aReflowInput,
ReflowOutput desiredSize(aReflowInput.reflowInput);
desiredSize.ClearSize();
LogicalPoint kidPosition(wm, aReflowInput.iCoord, aReflowInput.bCoord);
ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput,
wm, kidPosition, containerSize, 0, footerStatus);
ReflowChild(aTfoot, presContext, desiredSize, footerReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default,
footerStatus);
footerReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
PlaceChild(aReflowInput, aTfoot,
@ -3029,8 +3030,9 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
}
LogicalPoint kidPosition(wm, aReflowInput.iCoord, aReflowInput.bCoord);
ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput,
wm, kidPosition, containerSize, 0, aStatus);
ReflowChild(kidFrame, presContext, desiredSize, kidReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default,
aStatus);
kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
if (reorder) {
@ -3209,9 +3211,10 @@ nsTableFrame::ReflowColGroups(nsRenderingContext *aRenderingContext)
kidReflowInput(presContext, kidFrame, aRenderingContext,
LogicalSize(kidFrame->GetWritingMode()));
nsReflowStatus cgStatus;
ReflowChild(kidFrame, presContext, kidMet, kidReflowInput, 0, 0, 0,
cgStatus);
FinishReflowChild(kidFrame, presContext, kidMet, nullptr, 0, 0, 0);
ReflowChild(kidFrame, presContext, kidMet, kidReflowInput, 0, 0,
ReflowChildFlags::Default, cgStatus);
FinishReflowChild(kidFrame, presContext, kidMet, nullptr, 0, 0,
ReflowChildFlags::Default);
}
}
SetHaveReflowedColGroups(true);

View file

@ -386,7 +386,8 @@ nsTableRowFrame::DidResize()
FinishAndStoreOverflow(&desiredSize);
if (HasView()) {
nsContainerFrame::SyncFrameViewAfterReflow(PresContext(), this, GetView(),
desiredSize.VisualOverflow(), 0);
desiredSize.VisualOverflow(),
ReflowChildFlags::Default);
}
// Let our base class do the usual work
}
@ -812,7 +813,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
InitChildReflowInput(*aPresContext, LogicalSize(wm), false, kidReflowInput);
ReflowOutput desiredSize(aReflowInput);
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, 0, 0, 0, status);
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, 0, 0,
ReflowChildFlags::Default, status);
kidFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
continue;
@ -906,8 +908,9 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
*kidReflowInput);
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowInput,
wm, kidPosition, containerSize, 0, status);
ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default,
status);
// allow the table to determine if/how the table needs to be rebalanced
// If any of the cells are not complete, then we're not complete
@ -977,8 +980,8 @@ 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, 0);
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr, wm,
kidPosition, containerSize, ReflowChildFlags::Default);
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
firstReflow);
@ -1149,8 +1152,8 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
ReflowOutput desiredSize(aReflowInput);
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowInput, 0, 0,
ReflowChildFlags::NoMoveFrame, aStatus);
bool fullyComplete = NS_FRAME_IS_COMPLETE(aStatus) && !NS_FRAME_IS_TRUNCATED(aStatus);
if (fullyComplete) {
desiredSize.BSize(wm) = aAvailableBSize;

View file

@ -279,8 +279,8 @@ nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
bool isFirstReflow = aKidFrame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr,
aWM, aKidPosition, aContainerSize, 0);
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr, aWM,
aKidPosition, aContainerSize, ReflowChildFlags::Default);
nsTableFrame::InvalidateTableFrame(aKidFrame, aOriginalKidRect,
aOriginalKidVisualOverflow, isFirstReflow);
@ -411,8 +411,9 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
}
LogicalPoint kidPosition(wm, 0, aReflowInput.bCoord);
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput,
wm, kidPosition, containerSize, 0, aStatus);
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowInput, wm,
kidPosition, containerSize, ReflowChildFlags::Default,
aStatus);
kidReflowInput.ApplyRelativePositioning(&kidPosition, containerSize);
// Place the child
@ -1147,10 +1148,10 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
nsRect oldRowRect = rowFrame->GetRect();
nsRect oldRowVisualOverflow = rowFrame->GetVisualOverflowRect();
// Reflow the cell with the constrained height. A cell with rowspan >1 will get this
// reflow later during SplitSpanningCells.
ReflowChild(rowFrame, aPresContext, rowMetrics, rowReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
// Reflow the cell with the constrained height. A cell with rowspan >1
// will get this reflow later during SplitSpanningCells.
ReflowChild(rowFrame, aPresContext, rowMetrics, rowReflowInput, 0, 0,
ReflowChildFlags::NoMoveFrame, aStatus);
rowFrame->SetSize(nsSize(rowMetrics.Width(), rowMetrics.Height()));
rowFrame->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
rowFrame->DidResize();

View file

@ -822,7 +822,7 @@ nsTableWrapperFrame::OuterDoReflowChild(nsPresContext* aPresContext,
// Use the current position as a best guess for placement.
LogicalPoint childPt = aChildFrame->GetLogicalPosition(wm, zeroCSize);
uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
ReflowChildFlags flags = ReflowChildFlags::NoMoveFrame;
// We don't want to delete our next-in-flow's child if it's an inner table
// frame, because table wrapper frames always assume that their inner table
@ -830,7 +830,7 @@ nsTableWrapperFrame::OuterDoReflowChild(nsPresContext* aPresContext,
// a next-in-flow of an already complete table wrapper frame, then it will
// take care of removing it's inner table frame.
if (aChildFrame == InnerTableFrame()) {
flags |= NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD;
flags |= ReflowChildFlags::NoDeleteNextInFlowChild;
}
ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRI,
@ -1024,7 +1024,8 @@ nsTableWrapperFrame::Reflow(nsPresContext* aPresContext,
GetCaptionOrigin(captionSide, containSize, innerSize, innerMargin,
captionSize, captionMargin, captionOrigin, wm);
FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, *captionMet,
captionRI.ptr(), wm, captionOrigin, containerSize, 0);
captionRI.ptr(), wm, captionOrigin, containerSize,
ReflowChildFlags::Default);
captionRI.reset();
}
// XXX If the bsize is constrained then we need to check whether
@ -1034,7 +1035,7 @@ nsTableWrapperFrame::Reflow(nsPresContext* aPresContext,
GetInnerOrigin(captionSide, containSize, captionSize, captionMargin,
innerSize, innerMargin, innerOrigin, wm);
FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRI.ptr(),
wm, innerOrigin, containerSize, 0);
wm, innerOrigin, containerSize, ReflowChildFlags::Default);
innerRI.reset();
nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect,
@ -1051,8 +1052,8 @@ nsTableWrapperFrame::Reflow(nsPresContext* aPresContext,
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, aOuterRI,
aDesiredSize.mOverflowAreas, 0,
aStatus);
aDesiredSize.mOverflowAreas,
ReflowChildFlags::Default, aStatus);
}
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRI, aStatus);