[webkit-changes] [WebKit/WebKit] eaf5e5: Use min-intrinsic size to compute min-content size...

Sammy Gill noreply at github.com
Fri Oct 21 18:14:39 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eaf5e543e50d3ece7200e2ba6c9b24347d654bd9
      https://github.com/WebKit/WebKit/commit/eaf5e543e50d3ece7200e2ba6c9b24347d654bd9
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2022-10-21 (Fri, 21 Oct 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-002.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-004.html
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  Use min-intrinsic size to compute min-content size for non-replaced flex items.
https://bugs.webkit.org/show_bug.cgi?id=246755
rdar://101346126

Reviewed by Rob Buis.

There has been a lot of conversation on computing the min-content size
for flex items when computing the content size suggestion. In
particular, there were potential issues when computing the min-content
size for non-replaced flex items that were given an aspect-ratio
property. This issue was brought up in the following CSSWG
conversation: https://github.com/w3c/csswg-drafts/issues/6794

When the conversation was initially created, browsers all had different
behaviors. A patch was added to make WebKit behavior similar to the
behavior of Blink: https://github.com/WebKit/WebKit/pull/3025
The patch added behavior to take the aspect ratio into consideration
when computing these sizes.

This behavior ended up being incorrect by the time consensus was
reached. The final decision seems to be that we should be computing
the min-intrinsic size, which does not take into consideration the
aspect-ratio and is just based off of the content. The idea of the
min-intrinsic size was introduced here: https://github.com/w3c/csswg-drafts/issues/5305
Since our initial behavior was close to the behavior that was eventually
agreed upon, this patch ends up being mostly a revert. It is not
completely a revert, however, since there are still some pieces left in
from the initial patch.

If the item is a replaced element, we will start take into consideration
the aspect-ratio and compute the size using
computeMainSizeFromAspectRatioUsing. If the item is a non-replaced
element, instead we will compute the size using
computeMainAxisExtentForChild. This will compute the min-intrinsic
size by calling either child.computeLogicalWidthInFragmentUsing or
child.computeContentLogicalHeight.

Spec reference: https://drafts.csswg.org/css-flexbox-1/#min-size-auto
Follow up discussion: https://github.com/web-platform-tests/interop/issues/139

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-002.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-004.html:
Newest version of the tests

* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeFlexItemMinMaxSizes):

Canonical link: https://commits.webkit.org/255858@main




More information about the webkit-changes mailing list