Bug 1752658 Part 3 - Reduce scope of the struts array in Reflow(). r=dholbert

The `struts` array is used only within DoFlexLayout, so we should move it into
`if (!GetPrevInFlow()) { ... }` branch.

Also, move `nsTArray<StrutInfo>&` argument on DoFlexLayout() to the second to
last place so that the output arguments are grouped together after applying Part
4.

Differential Revision: https://phabricator.services.mozilla.com/D137363
This commit is contained in:
Ting-Yu Lin 2022-02-08 22:47:19 +00:00
Родитель 2b61aa41a4
Коммит f0a1413baf
2 изменённых файлов: 10 добавлений и 10 удалений

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

@ -4560,7 +4560,6 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
nscoord flexContainerAscent;
AutoTArray<FlexLine, 1> lines;
AutoTArray<StrutInfo, 1> struts;
AutoTArray<nsIFrame*, 1> placeholders;
if (!GetPrevInFlow()) {
@ -4593,9 +4592,10 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// TODO: This line will be removed in a later patch once the output
// arguments to DoFlexLayout is removed.
contentBoxMainSize = tentativeContentBoxMainSize;
AutoTArray<StrutInfo, 1> struts;
DoFlexLayout(aReflowInput, contentBoxMainSize, contentBoxCrossSize,
flexContainerAscent, lines, struts, placeholders, axisTracker,
mainGapSize, crossGapSize, hasLineClampEllipsis,
flexContainerAscent, lines, placeholders, axisTracker,
mainGapSize, crossGapSize, hasLineClampEllipsis, struts,
containerInfo);
if (!struts.IsEmpty()) {
@ -4603,8 +4603,8 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
lines.Clear();
placeholders.Clear();
DoFlexLayout(aReflowInput, contentBoxMainSize, contentBoxCrossSize,
flexContainerAscent, lines, struts, placeholders,
axisTracker, mainGapSize, crossGapSize, hasLineClampEllipsis,
flexContainerAscent, lines, placeholders, axisTracker,
mainGapSize, crossGapSize, hasLineClampEllipsis, struts,
containerInfo);
}
} else {
@ -5085,9 +5085,10 @@ bool nsFlexContainerFrame::IsUsedFlexBasisContent(
void nsFlexContainerFrame::DoFlexLayout(
const ReflowInput& aReflowInput, nscoord& aContentBoxMainSize,
nscoord& aContentBoxCrossSize, nscoord& aFlexContainerAscent,
nsTArray<FlexLine>& aLines, nsTArray<StrutInfo>& aStruts,
nsTArray<nsIFrame*>& aPlaceholders, const FlexboxAxisTracker& aAxisTracker,
nscoord aMainGapSize, nscoord aCrossGapSize, bool aHasLineClampEllipsis,
nsTArray<FlexLine>& aLines, nsTArray<nsIFrame*>& aPlaceholders,
const FlexboxAxisTracker& aAxisTracker, nscoord aMainGapSize,
nscoord aCrossGapSize, bool aHasLineClampEllipsis,
nsTArray<StrutInfo>& aStruts,
ComputedFlexContainerInfo* const aContainerInfo) {
MOZ_ASSERT(aLines.IsEmpty(), "Caller should pass an empty array for lines!");
MOZ_ASSERT(aPlaceholders.IsEmpty(),

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

@ -318,11 +318,10 @@ class nsFlexContainerFrame final : public nsContainerFrame {
void DoFlexLayout(const ReflowInput& aReflowInput,
nscoord& aContentBoxMainSize, nscoord& aContentBoxCrossSize,
nscoord& aFlexContainerAscent, nsTArray<FlexLine>& aLines,
nsTArray<StrutInfo>& aStruts,
nsTArray<nsIFrame*>& aPlaceholders,
const FlexboxAxisTracker& aAxisTracker,
nscoord aMainGapSize, nscoord aCrossGapSize,
bool aHasLineClampEllipsis,
bool aHasLineClampEllipsis, nsTArray<StrutInfo>& aStruts,
ComputedFlexContainerInfo* const aContainerInfo);
/**