[webkit-changes] [WebKit/WebKit] 39cc41: Consider Container Percentage Sizes When Determini...

Sammy Gill noreply at github.com
Thu Sep 22 10:08:41 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 39cc41965e9ea32db1eecab5bea00b539397d22a
      https://github.com/WebKit/WebKit/commit/39cc41965e9ea32db1eecab5bea00b539397d22a
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-definite-cross-size-constrained-percentage-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-definite-cross-size-constrained-percentage-ref.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexbox-definite-cross-size-constrained-percentage.html
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  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




More information about the webkit-changes mailing list