Issue #3153 - Make sure buttons report a definite size for flex containers.

This commit is contained in:
Brian Smith committed 2026-07-27 05:38:09 -05:00
1 parent dd9099a7d3
commit 3e223cbfb4
1 file changed
+13 -1
+13 -1
View File
@@ -234,7 +234,13 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
{
WritingMode wm = GetWritingMode();
LogicalSize availSize = aButtonReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_INTRINSICSIZE;
// Preserve the button's definite BSize so that flex/grid children inside
// see a definite containing block main size. Only clobber to intrinsic
// when the button itself has an indefinite BSize.
if (aButtonReflowInput.ComputedBSize() == NS_INTRINSICSIZE) {
availSize.BSize(wm) = NS_INTRINSICSIZE;
}
// shorthand for a value we need to use in a bunch of places
const LogicalMargin& clbp = aButtonReflowInput.ComputedLogicalBorderPadding();
@@ -248,6 +254,12 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
aFirstKid,
availSize);
// Also set the computed BSize directly on the inner reflow input so it
// gets used as-is by the anonymous flex container:
if (aButtonReflowInput.ComputedBSize() != NS_INTRINSICSIZE) {
contentsReflowInput.SetComputedBSize(aButtonReflowInput.ComputedBSize());
}
nsReflowStatus contentsReflowStatus;
ReflowOutput contentsDesiredSize(aButtonReflowInput);
childPos.B(wm) = 0; // This will be set properly later, after reflowing the