Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider Container Percentage Sizes When Determining Definite Cross Size
https://bugs.webkit.org/show_bug.cgi?id=245194 rdar://99469852 Reviewed by Alan Bujtas. When computing the transferred size suggestion for the minimum size of flex items, we need to use the intrinsic aspect ratio and the definite cross size. Both the Flexbox specification and CSS-Sizing specification provide information on when a size can be considered definite. This patch implements the following portion of the Flexbox spec to determine the definite cross size: If a single-line flex container has a definite cross size, the outer cross size of any stretched flex items is the flex container’s inner cross size (clamped to the flex item’s min and max cross size) and is considered definite. The new test case provides an instance of a scenario where this addition is important. The image is being used as a flex item, but the flex container is being constrained by another containing block that has a specified height that is smaller than the image. When computing the automatic minimum size (specifically the transferred size suggestion), we can determine that the flex container has a definite cross size using its percentage specified height along with the height available to it. Then, we can use this cross size along with the image's aspect ratio to determine the appropriate main size. Spec: https://www.w3.org/TR/css-flexbox-1/#min-size-auto https://www.w3.org/TR/css-flexbox-1/#definite * Source/WebCore/rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::childCrossSizeShouldUseContainerCrossSize const): (WebCore::RenderFlexibleBox::computeCrossSizeForChildUsingContainerCrossSize const): Canonical link: https://commits.webkit.org/254758@main
- Loading branch information
Showing 4 changed files with 64 additions and 3 deletions.