Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support aspect-ratio in intrinsic sizing
https://bugs.webkit.org/show_bug.cgi?id=220861 Patch by Rob Buis <rbuis@igalia.com> on 2021-03-08 Reviewed by Antti Koivisto. Source/WebCore: Support aspect-ratio in intrinsic sizing calculations. The values min-content/max-content/fit-content get set a value through aspect-ratio [1]. However min-width:auto is special, it should take content into account [2]. In order to support this, compute logical (intrinsic) width using MinIntrinsic, since staying with MinContent/MaxContent would cause an infinite loop. Behavior matches Firefox and Chrome. [1] https://www.w3.org/TR/css-sizing-4/#propdef-aspect-ratio [2] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum * rendering/RenderBlock.cpp: (WebCore::RenderBlock::computePreferredLogicalWidths): Compute child min/max pref widths from aspect-ratio if it applies. * rendering/RenderBox.cpp: (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): Add an allowIntrinsic parameter to prevent recursion. (WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): Compute intrinsic logical width from aspect ratio if possible. (WebCore::RenderBox::computeLogicalWidthInFragmentUsing const): (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const): min/max/fit-content in the block axis is treated as auto. (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const): Prevent recursion by passing false for allowIntrinsic. * rendering/RenderBox.h: LayoutTests: Enable tests that pass now. * TestExpectations: Canonical link: https://commits.webkit.org/235004@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
78c85d0
commit e730ca1
Showing
6 changed files
with
65 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters