[webkit-changes] [WebKit/WebKit] 28c5d0: Ensure transferred max size is floored by transfer...

Sammy Gill noreply at github.com
Wed Dec 21 13:10:20 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 28c5d0e82b0f2b000aa18734a3f2345ed9cfd86e
      https://github.com/WebKit/WebKit/commit/28c5d0e82b0f2b000aa18734a3f2345ed9cfd86e
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2022-12-21 (Wed, 21 Dec 2022)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-041-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-041.html
    M Source/WebCore/rendering/RenderBox.cpp

  Log Message:
  -----------
  Ensure transferred max size is floored by transferred min size in RenderReplaced::computeIntrinsicSizesConstrainedByTransferredMinMaxSizes.
https://bugs.webkit.org/show_bug.cgi?id=249617
rdar://103537352

Reviewed by Alan Baradlay.

Addresses a regression introduced by a change inside of
computeIntrinsicSizesConstrainedByTransferredMinMaxSizes. This method is
supposed to compute the intrinsic size and ratio of a replaced element and
also restrict that size if there are any transferred min/max constraints
that are violated. This code was not checking if the transferred max size
became smaller than the transferred min size. The max size is supposed to
be floored by the min size in order to avoid this scenario.

One situation in which this can happen is when we are computing the
min/max logical height, the containing block has an available width
of 0px, and the max-width specified is percentage based. When the call
to computeLogicalWidthInFragmentUsing returns, it will return a value of
0px when it resolves the percentage based max-width. Then, any specified
value of min-width greater than 0px will cause this issue. The new code
added addresses this issue by setting the max size to
max(min size, max size).

Ideally, we would be able to use RenderBox::constrainLogicalMinMaxSizesByAspectRatio,
which has this logic for us, but my attempt to do this was causing issues
when replaced elements were inside a flexbox.

Spec reference: https://www.w3.org/TR/css-sizing-4/#aspect-ratio-size-transfers

* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-041-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-041.html: Added.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computeMinMaxLogicalWidthFromAspectRatio const):
(WebCore::RenderBox::computeMinMaxLogicalHeightFromAspectRatio const):

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




More information about the webkit-changes mailing list