Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 797c5b0b8d2d86efe53139ec4fc3b181fb9f8e99
      
https://github.com/WebKit/WebKit/commit/797c5b0b8d2d86efe53139ec4fc3b181fb9f8e99
  Author: Alan Baradlay <[email protected]>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width.html
    M Source/WebCore/rendering/RenderBox.cpp

  Log Message:
  -----------
  [Flex] A flex item's flex base size should not be clamped by its own 
min/max-width
https://bugs.webkit.org/show_bug.cgi?id=317439
rdar://problem/180064739

Reviewed by Antti Koivisto.

    <div style="display: flex; width: 300px">
        <div style="min-width: 0; max-width: 100px"><div style="width: 
300px"></div></div>
        <div style="min-width: 0"><div style="width: 300px"></div></div>
    </div>

The first item should be 100px wide and the second 200px. Instead they were 
75px and 225px.

Each item holds 300px of content, so each has a 300px flex base size. Shrinking 
600px into a
300px container takes both toward 150px, the first then freezes at its 100px 
max-width and the
second takes the 200px left over. We clamped the first item's content-based 
contribution by its
own max-width before handing it over as the flex base size, so flexing started 
from a base of
100px instead of 300px and distributed the shrinkage 1:3 rather than 1:1.

Per CSS Flexbox the flex base size is the content size; the item's own min/max 
main sizes only
come in afterwards, when deriving the hypothetical main size. 
shouldIgnoreLogicalMinMaxWidthSizes()
already identifies a flex item being measured for its base size and 
RenderReplaced consults it,
so let's skip the clamps in constrainIntrinsicLogicalWidthsByMinMax() as well.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-base-size-ignores-max-width.html:
 Added.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::constrainIntrinsicLogicalWidthsByMinMax const):

Canonical link: https://commits.webkit.org/318264@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to