Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e8b0eb7ff13d9af3e7e2a187da9c3700f549053e
https://github.com/WebKit/WebKit/commit/e8b0eb7ff13d9af3e7e2a187da9c3700f549053e
Author: Alan Baradlay <[email protected]>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-min-content-trims-every-line-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-min-content-trims-every-line.html
M Source/WebCore/rendering/RenderFlexibleBox.cpp
Log Message:
-----------
[Flex] margin-trim is ignored for interior items when a wrapping flex
container is sized to min-content
https://bugs.webkit.org/show_bug.cgi?id=320564
Reviewed by Antti Koivisto.
computeIntrinsicLogicalWidths measures a flex item's margins once and adds the
same value to both the min-content
and the max-content width. The two are measured over different sets of flex
lines, though: max-content puts every
item on one line, while min-content for a wrapping container puts a break
between every item, so each one is alone
on its line.
margin-trim takes the inline margins of the items at the start and end of a
line. On the single line max-content
measures there are two such items; on the min-content lines every item is one,
at both ends. RenderFlexibleBox
trims the margins of the container's first and last flex items before layout,
which is the right answer for
max-content and feeds the same number into min-content, where it leaves every
interior item contributing margins
that will not be there.
So a container that sizes to min-content reports a width wider than the content
it then lays out. Three 50px items
with 100px inline margins and margin-trim: inline-start inline-end come out
250px wide when the same container's
layout puts each item alone on its line at 50px with both margins gone, leaving
200px of the container empty.
Take the margins off the min-content contribution of every item when the
container wraps and the corresponding
side is trimmed. Column flow keeps its existing behaviour: its min-content is a
max over items in the cross axis,
not a per-line break.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-min-content-trims-every-line-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-box/margin-trim/flex-min-content-trims-every-line.html:
Added.
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths const):
Canonical link: https://commits.webkit.org/318181@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications