summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsContainerFrame.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /layout/generic/nsContainerFrame.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--layout/generic/nsContainerFrame.cpp52
1 files changed, 29 insertions, 23 deletions
diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp
index 9629905968..2577a7a00d 100644
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -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,38 +1131,45 @@ 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),
- aReflowInput.AvailableSize(wm).BSize(wm));
- ReflowOutput desiredSize(aReflowInput);
+ // Note: aReflowInput's available inline-size is technically wrong for us
+ // to hand off to children here, because it doesn't account for the space
+ // that's been used for the container's margin/border/padding (and some
+ // other space that a concrete container type, e.g. fieldset and grid [1],
+ // might reserve before setting up the available space for their
+ // children). Since we don't have a way to query the specific available
+ // inline-size each container type used, nor do we know how the container
+ // computes its non-overflow-container children's inline-size, we just
+ // unconditionally override the frame's inline-size, so that the available
+ // inline-size for the children doesn't really matter anyway.
+ //
+ // [1] For example, fieldset uses its computed inline-size with padding as
+ // the available inline-size to reflow its inner child frame.
+ // https://searchfox.org/mozilla-central/rev/04f7743d94691fa24212fb43099f9d84c3bfc890/layout/forms/nsFieldSetFrame.cpp#535-536
+ const LogicalSize availSpace = aReflowInput.AvailableSize(wm);
StyleSizeOverrides sizeOverride;
- if (frame->IsFlexItem()) {
- // A flex item's size is determined by the flex algorithm, not solely by
- // its style. Thus, the following overrides are necessary.
- //
- // Use the overflow container flex item's prev-in-flow inline-size since
- // this continuation's inline-size is the same.
- sizeOverride.mStyleISize.emplace(
- StyleSize::LengthPercentage(LengthPercentage::FromAppUnits(
- frame->StylePosition()->mBoxSizing == StyleBoxSizing::Border
- ? prevRect.ISize(wm)
- : prevInFlow->ContentISize(wm))));
+ // We override current continuation's inline-size by using the
+ // prev-in-flow's inline-size since both should be the same.
+ sizeOverride.mStyleISize.emplace(
+ StyleSize::LengthPercentage(LengthPercentage::FromAppUnits(
+ frame->StylePosition()->mBoxSizing == StyleBoxSizing::Border
+ ? prevInFlow->ISize(wm)
+ : prevInFlow->ContentISize(wm))));
+ if (frame->IsFlexItem()) {
// 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,