Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1ba683f0efad28b70cf6ff2d71e8dcf84cc069ea
https://github.com/WebKit/WebKit/commit/1ba683f0efad28b70cf6ff2d71e8dcf84cc069ea
Author: Alan Baradlay <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout.html
M
Source/WebCore/layout/integration/LayoutIntegrationFormattingContextLayout.cpp
M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
M Source/WebCore/page/LocalFrameViewLayoutContext.h
M Source/WebCore/rendering/GridLanesLayout.cpp
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderLayoutState.cpp
M Source/WebCore/rendering/RenderLayoutState.h
Log Message:
-----------
A block-level aspect-ratio box inside a float grows when its content changes
https://bugs.webkit.org/show_bug.cgi?id=325890
<rdar://problem/188872195>
Reviewed by Antti Koivisto.
<div style="float: left">
<div style="aspect-ratio: 1">
<div style="height: 100%; aspect-ratio: 2">
<div style="width: 20px; height: 5px"></div>
</div>
</div>
</div>
The aspect-ratio box should stay 20px wide when its content changes. Instead it
doubled on every change.
availableLogicalHeightForPercentageComputation() derives the box's height from
logicalWidth(), which still holds the previous layout's width while the box
measures its own intrinsic widths.
It uses dirty bits to signal intrinsic width computation, and only for grid and
shrink-to-fit boxes, so the float's measurement of this block-level box feeds
the old width back in.
Let's mark the box while it measures its own intrinsic widths instead, with
IntrinsicLogicalWidthComputationScope (the inline-axis counterpart of
IntrinsicLogicalHeightComputationScope), and bail out only inside that scope.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-shrink-to-fit-ancestor-relayout.html:
Added.
*
Source/WebCore/layout/integration/LayoutIntegrationFormattingContextLayout.cpp:
(WebCore::LayoutIntegration::formattingContextRootLogicalWidthForType):
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp:
(WebCore::LocalFrameViewLayoutContext::addIntrinsicLogicalWidthComputationFor):
(WebCore::LocalFrameViewLayoutContext::removeIntrinsicLogicalWidthComputationFor):
(WebCore::LocalFrameViewLayoutContext::isComputingIntrinsicLogicalWidthFor
const):
* Source/WebCore/page/LocalFrameViewLayoutContext.h:
* Source/WebCore/rendering/GridLanesLayout.cpp:
(WebCore::GridLanesLayout::calculateGridLanesIntrinsicLogicalWidth):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::minContentLogicalWidthContribution const):
(WebCore::RenderBox::maxContentLogicalWidthContribution const):
(WebCore::RenderBox::computeLogicalWidthUsingGeneric const):
(WebCore::RenderBox::computeOutOfFlowPositionedLogicalWidthUsing const):
* Source/WebCore/rendering/RenderLayoutState.cpp:
(WebCore::IntrinsicLogicalWidthComputationScope::IntrinsicLogicalWidthComputationScope):
(WebCore::IntrinsicLogicalWidthComputationScope::~IntrinsicLogicalWidthComputationScope):
* Source/WebCore/rendering/RenderLayoutState.h:
Canonical link: https://commits.webkit.org/322742@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications