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

@ -835,9 +835,9 @@ nsMathMLContainerFrame::ReflowChild(nsIFrame* aChildFrame,
NS_ASSERTION(!inlineFrame, "Inline frames should be wrapped in blocks");
#endif
nsContainerFrame::
ReflowChild(aChildFrame, aPresContext, aDesiredSize, aReflowInput,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
nsContainerFrame::ReflowChild(aChildFrame, aPresContext, aDesiredSize,
aReflowInput, 0, 0,
ReflowChildFlags::NoMoveFrame, aStatus);
if (aDesiredSize.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
// This will be suitable for inline frames, which are wrapped in a block.
@ -1311,7 +1311,7 @@ nsMathMLContainerFrame::PositionRowChildFrames(nscoord aOffsetX,
nscoord dx = aOffsetX + child.X();
nscoord dy = aBaseline - child.Ascent();
FinishReflowChild(child.Frame(), PresContext(), child.GetReflowOutput(),
nullptr, dx, dy, 0);
nullptr, dx, dy, ReflowChildFlags::Default);
++child;
}
}

View file

@ -178,7 +178,8 @@ nsMathMLSelectedFrame::Place(DrawTarget* aDrawTarget,
if (childFrame) {
GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
if (aPlaceOrigin) {
FinishReflowChild(childFrame, PresContext(), aDesiredSize, nullptr, 0, 0, 0);
FinishReflowChild(childFrame, PresContext(), aDesiredSize, nullptr, 0, 0,
ReflowChildFlags::Default);
}
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();

View file

@ -193,7 +193,8 @@ nsMathMLTokenFrame::Place(DrawTarget* aDrawTarget,
// place and size the child; (dx,0) makes the caret happy - bug 188146
dy = childSize.Height() == 0 ? 0 : aDesiredSize.BlockStartAscent() - childSize.BlockStartAscent();
FinishReflowChild(childFrame, PresContext(), childSize, nullptr, dx, dy, 0);
FinishReflowChild(childFrame, PresContext(), childSize, nullptr, dx, dy,
ReflowChildFlags::Default);
dx += childSize.Width();
}
}

View file

@ -403,8 +403,9 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
else
aDesiredSize.mBoundingMetrics += bm;
FinishReflowChild(childFrame, aPresContext, childSize, nullptr,
dx, ascent - childSize.BlockStartAscent(), 0);
FinishReflowChild(childFrame, aPresContext, childSize, nullptr, dx,
ascent - childSize.BlockStartAscent(),
ReflowChildFlags::Default);
dx += childSize.Width();
if (i < mSeparatorsCount) {

View file

@ -451,10 +451,12 @@ nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
nscoord dy;
// place numerator
dy = 0;
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dxNum, dy, 0);
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dxNum, dy,
ReflowChildFlags::Default);
// place denominator
dy = aDesiredSize.Height() - sizeDen.Height();
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dxDen, dy, 0);
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dxDen, dy,
ReflowChildFlags::Default);
// place the fraction bar - dy is top of bar
dy = aDesiredSize.BlockStartAscent() - (axisHeight + actualRuleThickness/2);
mLineRect.SetRect(leftSpace, dy, width - (leftSpace + rightSpace),
@ -571,7 +573,8 @@ nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
dx = MirrorIfRTL(aDesiredSize.Width(), sizeNum.Width(),
leadingSpace);
dy = aDesiredSize.BlockStartAscent() - numShift - sizeNum.BlockStartAscent();
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dx, dy, 0);
FinishReflowChild(frameNum, presContext, sizeNum, nullptr, dx, dy,
ReflowChildFlags::Default);
// place the fraction bar
dx = MirrorIfRTL(aDesiredSize.Width(), mLineRect.width,
@ -584,7 +587,8 @@ nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
dx = MirrorIfRTL(aDesiredSize.Width(), sizeDen.Width(),
leadingSpace + bmNum.width + mLineRect.width);
dy = aDesiredSize.BlockStartAscent() + denShift - sizeDen.BlockStartAscent();
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dx, dy, 0);
FinishReflowChild(frameDen, presContext, sizeDen, nullptr, dx, dy,
ReflowChildFlags::Default);
}
}

View file

@ -632,11 +632,11 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
// place the base ...
childFrame = baseFrame;
dy = aDesiredSize.BlockStartAscent() - baseSize.BlockStartAscent();
FinishReflowChild (baseFrame, aPresContext, baseSize, nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
baseSize.Width(),
dx),
dy, 0);
FinishReflowChild(baseFrame, aPresContext, baseSize, nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
baseSize.Width(),
dx),
dy, ReflowChildFlags::Default);
dx += bmBase.width;
} else if (prescriptsFrame == childFrame) {
// Clear reflow flags of prescripts frame.
@ -668,12 +668,12 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
x += width - subScriptSize.Width();
dy = aDesiredSize.BlockStartAscent() - subScriptSize.BlockStartAscent() +
maxSubScriptShift;
FinishReflowChild (subScriptFrame, aPresContext, subScriptSize,
nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
subScriptSize.Width(),
x),
dy, 0);
FinishReflowChild(subScriptFrame, aPresContext, subScriptSize,
nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
subScriptSize.Width(),
x),
dy, ReflowChildFlags::Default);
}
if (supScriptFrame) {
@ -686,12 +686,12 @@ nsMathMLmmultiscriptsFrame::PlaceMultiScript(nsPresContext* aPresContext,
}
dy = aDesiredSize.BlockStartAscent() - supScriptSize.BlockStartAscent() -
maxSupScriptShift;
FinishReflowChild (supScriptFrame, aPresContext, supScriptSize,
nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
supScriptSize.Width(),
x),
dy, 0);
FinishReflowChild(supScriptFrame, aPresContext, supScriptSize,
nullptr,
aFrame->MirrorIfRTL(aDesiredSize.Width(),
supScriptSize.Width(),
x),
dy, ReflowChildFlags::Default);
}
dx += width + scriptSpace;
}

View file

@ -333,7 +333,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
(indexRaisedAscent + indexSize.BlockStartAscent() - bmIndex.ascent);
FinishReflowChild(indexFrame, aPresContext, indexSize, nullptr,
MirrorIfRTL(aDesiredSize.Width(), indexSize.Width(), dx),
dy, 0);
dy, ReflowChildFlags::Default);
// place the radical symbol and the radical bar
dx = dxSqr;
@ -347,8 +347,8 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
// place the base
dy = aDesiredSize.BlockStartAscent() - baseSize.BlockStartAscent();
FinishReflowChild(baseFrame, aPresContext, baseSize, nullptr,
MirrorIfRTL(aDesiredSize.Width(), baseSize.Width(), dx),
dy, 0);
MirrorIfRTL(aDesiredSize.Width(), baseSize.Width(), dx), dy,
ReflowChildFlags::Default);
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();

View file

@ -668,18 +668,20 @@ nsMathMLmunderoverFrame::Place(DrawTarget* aDrawTarget,
dy = aDesiredSize.BlockStartAscent() -
mBoundingMetrics.ascent + bmOver.ascent -
overSize.BlockStartAscent();
FinishReflowChild (overFrame, PresContext(), overSize, nullptr, dxOver, dy, 0);
FinishReflowChild(overFrame, PresContext(), overSize, nullptr, dxOver, dy,
ReflowChildFlags::Default);
}
// place base
dy = aDesiredSize.BlockStartAscent() - baseSize.BlockStartAscent();
FinishReflowChild (baseFrame, PresContext(), baseSize, nullptr, dxBase, dy, 0);
FinishReflowChild(baseFrame, PresContext(), baseSize, nullptr, dxBase, dy,
ReflowChildFlags::Default);
// place underscript
if (underFrame) {
dy = aDesiredSize.BlockStartAscent() +
mBoundingMetrics.descent - bmUnder.descent -
underSize.BlockStartAscent();
FinishReflowChild (underFrame, PresContext(), underSize, nullptr,
dxUnder, dy, 0);
FinishReflowChild(underFrame, PresContext(), underSize, nullptr,
dxUnder, dy, ReflowChildFlags::Default);
}
}
return NS_OK;