Bug 563436 Part 1 - Minor clean up in ReflowOverflowContainerChildren(). r=dholbert

Remove `prevRect` and comments that don't seem useful; move variable
declarations closer to their usage sites. This is a preparation for Part 2.

This doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D204579
This commit is contained in:
Ting-Yu Lin
2024-03-14 23:40:49 +00:00
parent 4c3e18b570
commit 50e85d0f20

View File

@@ -1124,7 +1124,6 @@ void nsContainerFrame::ReflowOverflowContainerChildren(
// isn't dirty.
if (shouldReflowAllKids || frame->IsSubtreeDirty() ||
ScrollableOverflowExceedsAvailableBSize(frame)) {
// Get prev-in-flow
nsIFrame* prevInFlow = frame->GetPrevInFlow();
NS_ASSERTION(prevInFlow,
"overflow container frame must have a prev-in-flow");
@@ -1132,15 +1131,8 @@ void nsContainerFrame::ReflowOverflowContainerChildren(
frame->HasAnyStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER),
"overflow container frame must have overflow container bit set");
WritingMode wm = frame->GetWritingMode();
nsSize containerSize =
aContainerSize ? *aContainerSize
: aReflowInput.AvailableSize(wm).GetPhysicalSize(wm);
LogicalRect prevRect = prevInFlow->GetLogicalRect(wm, containerSize);
// Initialize reflow params
LogicalSize availSpace(wm, prevRect.ISize(wm),
LogicalSize availSpace(wm, prevInFlow->ISize(wm),
aReflowInput.AvailableSize(wm).BSize(wm));
ReflowOutput desiredSize(aReflowInput);
StyleSizeOverrides sizeOverride;
if (frame->IsFlexItem()) {
@@ -1152,18 +1144,22 @@ void nsContainerFrame::ReflowOverflowContainerChildren(
sizeOverride.mStyleISize.emplace(
StyleSize::LengthPercentage(LengthPercentage::FromAppUnits(
frame->StylePosition()->mBoxSizing == StyleBoxSizing::Border
? prevRect.ISize(wm)
? prevInFlow->ISize(wm)
: prevInFlow->ContentISize(wm))));
// An overflow container's block-size must be 0.
sizeOverride.mStyleBSize.emplace(
StyleSize::LengthPercentage(LengthPercentage::FromAppUnits(0)));
}
ReflowOutput desiredSize(wm);
ReflowInput reflowInput(aPresContext, aReflowInput, frame, availSpace,
Nothing(), {}, sizeOverride);
LogicalPoint pos(wm, prevRect.IStart(wm), 0);
const nsSize containerSize =
aContainerSize ? *aContainerSize
: aReflowInput.AvailableSize(wm).GetPhysicalSize(wm);
const LogicalPoint pos(wm, prevInFlow->IStart(wm, containerSize), 0);
nsReflowStatus frameStatus;
ReflowChild(frame, aPresContext, desiredSize, reflowInput, wm, pos,
containerSize, aFlags, frameStatus, &tracker);
FinishReflowChild(frame, aPresContext, desiredSize, &reflowInput, wm, pos,