Changeset 272360 in webkit


Ignore:
Timestamp:
Feb 3, 2021 11:59:45 PM (3 years ago)
Author:
commit-queue@webkit.org
Message:

Handle aspect-ratio: auto m/n for replaced elements
https://bugs.webkit.org/show_bug.cgi?id=221323

Patch by Rob Buis <rbuis@igalia.com> on 2021-02-03
Reviewed by Simon Fraser.

Source/WebCore:

In the aspect-ratio: auto m/n case, replaced elements with natural aspect ratio
should use that aspect-ratio instead of the provided aspect ratio [1].

[1] https://drafts.csswg.org/css-sizing-4/#ratios

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalWidthInFragment const):

LayoutTests:

replaced-element-030.html now passes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r272359 r272360  
     12021-02-03  Rob Buis  <rbuis@igalia.com>
     2
     3        Handle aspect-ratio: auto m/n for replaced elements
     4        https://bugs.webkit.org/show_bug.cgi?id=221323
     5
     6        Reviewed by Simon Fraser.
     7
     8        replaced-element-030.html now passes.
     9
     10        * TestExpectations:
     11
    1122021-02-03  Peng Liu  <peng.liu6@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r272315 r272360  
    44494449webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-010.html [ ImageOnlyFailure ]
    44504450webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-011.html [ ImageOnlyFailure ]
    4451 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-030.html [ ImageOnlyFailure ]
    44524451webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html [ ImageOnlyFailure ]
    44534452webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r272359 r272360  
     12021-02-03  Rob Buis  <rbuis@igalia.com>
     2
     3        Handle aspect-ratio: auto m/n for replaced elements
     4        https://bugs.webkit.org/show_bug.cgi?id=221323
     5
     6        Reviewed by Simon Fraser.
     7
     8        In the aspect-ratio: auto m/n case, replaced elements with natural aspect ratio
     9        should use that aspect-ratio instead of the provided aspect ratio [1].
     10
     11        [1] https://drafts.csswg.org/css-sizing-4/#ratios
     12
     13        * rendering/RenderBox.cpp:
     14        (WebCore::RenderBox::computeLogicalWidthInFragment const):
     15
    1162021-02-03  Peng Liu  <peng.liu6@apple.com>
    217
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r272309 r272360  
    25492549
    25502550    // Width calculations
    2551     if (shouldComputeLogicalWidthFromAspectRatio() && style().logicalWidth().isAuto()) {
     2551    if (treatAsReplaced) {
     2552        computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
     2553    } else if (shouldComputeLogicalWidthFromAspectRatio() && style().logicalWidth().isAuto()) {
    25522554        computedValues.m_extent = computeLogicalWidthFromAspectRatio(fragment);
    2553     } else if (treatAsReplaced) {
    2554         computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
    25552555    } else {
    25562556        LayoutUnit preferredWidth = computeLogicalWidthInFragmentUsing(MainOrPreferredSize, styleToUse.logicalWidth(), containerWidthInInlineDirection, cb, fragment);
Note: See TracChangeset for help on using the changeset viewer.