Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cfdf243580b542216d69c677e770f20c33a7917a
https://github.com/WebKit/WebKit/commit/cfdf243580b542216d69c677e770f20c33a7917a
Author: Alan Baradlay <[email protected]>
Date: 2026-04-20 (Mon, 20 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/fast/flexbox/quirks-percentage-height-in-flex-item-deep-expected.html
A LayoutTests/fast/flexbox/quirks-percentage-height-in-flex-item-deep.html
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderBlockFlow.h
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
Log Message:
-----------
Stretch relayout should propagate to deeply nested percent-height descendants
https://bugs.webkit.org/show_bug.cgi?id=210243
Reviewed by Antti Koivisto.
Consider this quirks mode test case:
<div style="display: flex">
<div> <!-- flex item (wrapper) -->
<div> <!-- intermediate auto-height div -->
<div> <!-- intermediate auto-height div -->
<div style="height: 100%"> <!-- .percent -->
1. The flex container lays out its flex item.
During this layout, in computePercentageLogicalHeight .percent gets registers
as a percent-height descendant
of the flex box (not the flex item).
2. The flex container determines the line cross size (height) and stretches the
flex item. applyStretchAlignmentToFlexItem detects that the flex item
has percent-height descendants and triggers a stretch relayout.
3. The stretch relayout marks the flex item dirty with MarkOnlyThis and
calls layoutIfNeeded(). But the intermediate auto-height divs are clean
from the previous layout pass, so layout never reaches .pct.
Normally, RenderBlockFlow::dirtyForLayoutFromPercentageHeightDescendants
handles this - it walks from each registered descendant up to the block,
dirtying every ancestor along the way. But that only works for descendants
registered on the block itself. Here, .percent is registered on the flex
container, not the flex item, so the flex item's
dirtyForLayoutFromPercentageHeightDescendants finds nothing.
The fix extracts the per-descendant dirtying logic into a new
dirtyForLayoutFromPercentageHeightDescendant method and calls it from
dirtyPercentHeightDescendantsWithinFlexItem. This iterates the flex
container's registered descendants, finds those under the flex item
being stretched, and dirties the chain from each descendant up to the
flex item. The flex item is already marked dirty so the chain stops there.
Test: fast/flexbox/quirks-percentage-height-in-flex-item-deep.html
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::dirtyForLayoutFromPercentageHeightDescendant):
(WebCore::RenderBlockFlow::dirtyForLayoutFromPercentageHeightDescendants):
* Source/WebCore/rendering/RenderBlockFlow.h:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::dirtyPercentHeightDescendantsWithinFlexItem):
(WebCore::RenderFlexibleBox::applyStretchAlignmentToFlexItem):
* Source/WebCore/rendering/RenderFlexibleBox.h:
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Canonical link: https://commits.webkit.org/311590@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications