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

@ -460,10 +460,10 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
// Allow the child to move/size/change-visibility its view if it's currently
// dropped down
int32_t flags = mDroppedDown ? 0
: NS_FRAME_NO_MOVE_FRAME |
NS_FRAME_NO_VISIBILITY |
NS_FRAME_NO_SIZE_VIEW;
ReflowChildFlags flags = mDroppedDown ? ReflowChildFlags::Default
: ReflowChildFlags::NoMoveFrame |
ReflowChildFlags::NoVisibility |
ReflowChildFlags::NoSizeView;
//XXX Can this be different from the dropdown's writing mode?
// That would be odd!

View file

@ -233,8 +233,8 @@ nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
// will be fixed later.
const nsSize dummyContainerSize;
ReflowChild(inputAreaFrame, aPresContext, childDesiredSize,
childReflowOuput, myWM, childOffset, dummyContainerSize, 0,
childStatus);
childReflowOuput, myWM, childOffset, dummyContainerSize,
ReflowChildFlags::Default, childStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
"We gave our child unconstrained available block-size, "
"so it should be complete");
@ -271,7 +271,8 @@ nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
// Place the child
FinishReflowChild(inputAreaFrame, aPresContext, childDesiredSize,
&childReflowOuput, myWM, childOffset, borderBoxSize, 0);
&childReflowOuput, myWM, childOffset, borderBoxSize,
ReflowChildFlags::Default);
nsSize contentBoxSize =
LogicalSize(myWM, contentBoxISize, contentBoxBSize).

View file

@ -397,8 +397,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds, 0,
ocStatus);
ReflowOverflowContainerChildren(aPresContext, aReflowInput, ocBounds,
ReflowChildFlags::Default, ocStatus);
}
//------------ Handle Incremental Reflow -----------------
@ -459,7 +459,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
const nsSize dummyContainerSize;
ReflowChild(legend, aPresContext, legendDesiredSize, *legendReflowInput,
wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, aStatus);
ReflowChildFlags::NoMoveFrame, aStatus);
#ifdef NOISY_REFLOW
printf(" returned (%d, %d)\n",
legendDesiredSize.Width(), legendDesiredSize.Height());
@ -488,7 +488,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
FinishReflowChild(legend, aPresContext, legendDesiredSize,
legendReflowInput.ptr(), wm, LogicalPoint(wm),
dummyContainerSize, NS_FRAME_NO_MOVE_FRAME);
dummyContainerSize, ReflowChildFlags::NoMoveFrame);
} else if (!legend) {
mLegendRect.SetEmpty();
mLegendSpace = 0;
@ -540,13 +540,13 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
// if necessary.
const nsSize dummyContainerSize;
ReflowChild(inner, aPresContext, kidDesiredSize, kidReflowInput,
wm, pt, dummyContainerSize, 0, aStatus);
wm, pt, dummyContainerSize, ReflowChildFlags::Default, aStatus);
// Update containerSize to account for size of the inner frame, so that
// FinishReflowChild can position it correctly.
containerSize += kidDesiredSize.PhysicalSize();
FinishReflowChild(inner, aPresContext, kidDesiredSize,
&kidReflowInput, wm, pt, containerSize, 0);
FinishReflowChild(inner, aPresContext, kidDesiredSize, &kidReflowInput, wm,
pt, containerSize, ReflowChildFlags::Default);
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
} else if (inner) {
// |inner| didn't need to be reflowed but we do need to include its size

View file

@ -333,7 +333,8 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
nsSize dummyContainerSize;
ReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, contentsReflowInput,
wm, childPos, dummyContainerSize, 0, contentsReflowStatus);
wm, childPos, dummyContainerSize, ReflowChildFlags::Default,
contentsReflowStatus);
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(contentsReflowStatus),
"We gave button-contents frame unconstrained available height, "
"so it should be complete");
@ -386,9 +387,9 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
(buttonContentBox + clbp.Size(wm)).GetPhysicalSize(wm);
// Place the child
FinishReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, &contentsReflowInput,
wm, childPos, containerSize, 0);
FinishReflowChild(aFirstKid, aPresContext, contentsDesiredSize,
&contentsReflowInput, wm, childPos, containerSize,
ReflowChildFlags::Default);
// Make sure we have a useful 'ascent' value for the child
if (contentsDesiredSize.BlockStartAscent() ==

View file

@ -187,9 +187,9 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
ReflowOutput barDesiredSize(reflowInput);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowInput, xoffset,
yoffset, 0, aStatus);
yoffset, ReflowChildFlags::Default, aStatus);
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowInput,
xoffset, yoffset, 0);
xoffset, yoffset, ReflowChildFlags::Default);
}
nsresult

View file

@ -181,8 +181,8 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
// will be fixed later.
const nsSize dummyContainerSize;
ReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
wrapperReflowInput, myWM, wrapperOffset, dummyContainerSize, 0,
childStatus);
wrapperReflowInput, myWM, wrapperOffset, dummyContainerSize,
ReflowChildFlags::Default, childStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
"We gave our child unconstrained available block-size, "
"so it should be complete");
@ -219,8 +219,8 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
// Place the child
FinishReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
&wrapperReflowInput, myWM, wrapperOffset,
borderBoxSize, 0);
&wrapperReflowInput, myWM, wrapperOffset, borderBoxSize,
ReflowChildFlags::Default);
nsSize contentBoxSize =
LogicalSize(myWM, contentBoxISize, contentBoxBSize).

View file

@ -203,9 +203,9 @@ nsProgressFrame::ReflowChildFrame(nsIFrame* aChild,
ReflowOutput barDesiredSize(aReflowInput);
ReflowChild(aChild, aPresContext, barDesiredSize, reflowInput, xoffset,
yoffset, 0, aStatus);
yoffset, ReflowChildFlags::Default, aStatus);
FinishReflowChild(aChild, aPresContext, barDesiredSize, &reflowInput,
xoffset, yoffset, 0);
xoffset, yoffset, ReflowChildFlags::Default);
}
nsresult

View file

@ -415,12 +415,13 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
nsReflowStatus frameStatus;
ReflowOutput trackDesiredSize(aReflowInput);
ReflowChild(trackFrame, aPresContext, trackDesiredSize,
trackReflowInput, trackX, trackY, 0, frameStatus);
ReflowChild(trackFrame, aPresContext, trackDesiredSize, trackReflowInput,
trackX, trackY, ReflowChildFlags::Default, frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(trackFrame, aPresContext, trackDesiredSize,
&trackReflowInput, trackX, trackY, 0);
&trackReflowInput, trackX, trackY,
ReflowChildFlags::Default);
}
nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
@ -437,12 +438,12 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
nsReflowStatus frameStatus;
ReflowOutput thumbDesiredSize(aReflowInput);
ReflowChild(thumbFrame, aPresContext, thumbDesiredSize,
thumbReflowInput, 0, 0, 0, frameStatus);
ReflowChild(thumbFrame, aPresContext, thumbDesiredSize, thumbReflowInput, 0,
0, ReflowChildFlags::Default, frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(thumbFrame, aPresContext, thumbDesiredSize,
&thumbReflowInput, 0, 0, 0);
&thumbReflowInput, 0, 0, ReflowChildFlags::Default);
DoUpdateThumbPosition(thumbFrame, nsSize(aDesiredSize.Width(),
aDesiredSize.Height()));
}
@ -462,13 +463,13 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
nsReflowStatus frameStatus;
ReflowOutput progressDesiredSize(aReflowInput);
ReflowChild(rangeProgressFrame, aPresContext,
progressDesiredSize, progressReflowInput, 0, 0,
0, frameStatus);
ReflowChild(rangeProgressFrame, aPresContext, progressDesiredSize,
progressReflowInput, 0, 0, ReflowChildFlags::Default,
frameStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
"We gave our child unconstrained height, so it should be complete");
FinishReflowChild(rangeProgressFrame, aPresContext,
progressDesiredSize, &progressReflowInput, 0, 0, 0);
FinishReflowChild(rangeProgressFrame, aPresContext, progressDesiredSize,
&progressReflowInput, 0, 0, ReflowChildFlags::Default);
DoUpdateRangeProgressFrame(rangeProgressFrame, nsSize(aDesiredSize.Width(),
aDesiredSize.Height()));
}

View file

@ -581,12 +581,12 @@ nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
// reflow the child
ReflowOutput desiredSize(aReflowInput);
ReflowChild(aKid, aPresContext, desiredSize, kidReflowInput,
xOffset, yOffset, 0, aStatus);
ReflowChild(aKid, aPresContext, desiredSize, kidReflowInput, xOffset, yOffset,
ReflowChildFlags::Default, aStatus);
// place the child
FinishReflowChild(aKid, aPresContext, desiredSize,
&kidReflowInput, xOffset, yOffset, 0);
FinishReflowChild(aKid, aPresContext, desiredSize, &kidReflowInput, xOffset,
yOffset, ReflowChildFlags::Default);
// consider the overflow
aParentDesiredSize.mOverflowAreas.UnionWith(desiredSize.mOverflowAreas);