Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6a41925ab1d9aa1a650161f6d674802f7a468fe
      
https://github.com/WebKit/WebKit/commit/f6a41925ab1d9aa1a650161f6d674802f7a468fe
  Author: Alan Baradlay <[email protected]>
  Date:   2026-06-04 (Thu, 04 Jun 2026)

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

  Log Message:
  -----------
  [Flex] A flex item with min-width: min-content is clamped to a smaller 
max-width
https://bugs.webkit.org/show_bug.cgi?id=316353

Reviewed by Antti Koivisto.

    <div style="display: flex">
        <div style="min-width: min-content; max-width: 40px">X XXXXXXXXXXX</div>
    </div>

The flex item should be at least as wide as its min-content (the widest word),
because min-width wins over a smaller max-width.
Instead it was clamped to the 40px max-width.

A box caches its min-content and max-content contributions already clamped by 
its
own min-width and max-width. That clamp honored a max-content min-width but not 
a
min-content one, so min-width: min-content counted as zero and the smaller
max-width pulled the cached contribution down.
A flex item takes that contribution as its used size, so it ended up at 
max-width.

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

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



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

Reply via email to