Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 62e556103e58e0c69249cc8a7ff578e9799c68f5
https://github.com/WebKit/WebKit/commit/62e556103e58e0c69249cc8a7ff578e9799c68f5
Author: Alan Baradlay <[email protected]>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderBlock.h
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderBox.h
M Source/WebCore/rendering/RenderBoxModelObject.cpp
Log Message:
-----------
Fix /css/css-sizing/margin-collapse-with-indefinite-block-size-001.html (002,
003, 004, 005)
https://bugs.webkit.org/show_bug.cgi?id=316094
Reviewed by Antti Koivisto.
<div style="width: 100px; height: 100%; background: red">
<div style="height: 100px; margin-bottom: 100px; background: green"></div>
</div>
The green box should be a 100px square with no red. Instead the red container
was 200px tall, showing 100px of red below the green: the child's bottom margin
did not collapse through the container.
When deciding whether a block's bottom margin collapses with its last in-flow
child's, we only treated a literal height:auto as collapsible. A height of 100%
(a cyclic percentage), min-content, max-content, fit-content, or stretch is not
the auto keyword, so the child's bottom margin was kept inside the container.
CSS Sizing 3 says those values behave as auto. logicalHeightBehavesAsAuto() now
treats auto, the intrinsic keywords, an unresolveable stretch, and a percentage
that does not resolve against the containing block as auto. Resolvability is
read
from style only (the containing block's
hasDefiniteLogicalHeightForPercentageResolutionFromStyle),
so the margin-collapse query stays side-effect-free and independent of layout
phase.
* LayoutTests/TestExpectations:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::hasDefiniteLogicalHeightForPercentageResolutionFromStyle
const):
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::MarginInfo::MarginInfo):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::logicalHeightBehavesAsAuto const):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::relativePositionOffset const):
(WebCore::hasDefiniteHeightByStyle): Deleted.
Canonical link: https://commits.webkit.org/314392@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications