Changeset 270116 in webkit


Ignore:
Timestamp:
Nov 20, 2020 8:09:32 AM (3 years ago)
Author:
svillar@igalia.com
Message:

[css-flex] Images as flex items should use the overridingLogicalWidth when defined to compute the logical height
https://bugs.webkit.org/show_bug.cgi?id=219195

Reviewed by Manuel Rego Casasnovas.

LayoutTests/imported/w3c:

Replaced 15 FAIL by PASS expectations.

  • web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt:
  • web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt:
  • web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt:
  • web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt:
  • web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt:

Source/WebCore:

This is the same fix than the one we did in r270073 but for the other axis. RenderReplaced should use the overridingLogicalWidth
whenever defined instead of the specified logical width to compute the logical height using an intrinsic aspect ratio.
The overriding width is set by flex containers that need to stretch/shrink their items. The current code was not considering
this case and thus, the intrinsic (non-stretched) logical height was used to compute the logical width,
meaning that the stretching set by the flexbox container was ignored.

This patch allows WebKit to pass 15 subtests in already existing aspect ratio flexbox tests from WPT.

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::computeReplacedLogicalHeight const): Use the overriding logical width if defined in presence of a valid aspect ratio.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r270102 r270116  
     12020-11-20  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flex] Images as flex items should use the overridingLogicalWidth when defined to compute the logical height
     4        https://bugs.webkit.org/show_bug.cgi?id=219195
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        Replaced 15 FAIL by PASS expectations.
     9
     10        * web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt:
     11        * web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt:
     12        * web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt:
     13        * web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt:
     14        * web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt:
     15
    1162020-11-20  Chris Lord  <clord@igalia.com>
    217
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt

    r269628 r270116  
    99PASS .flexbox > img 2
    1010PASS .flexbox > img 3
    11 FAIL .flexbox > img 4 assert_equals:
    12 <img src="support/solidblue.png" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="30">
    13 height expected 30 but got 16
     11PASS .flexbox > img 4
    1412PASS .flexbox > img 5
    1513PASS .flexbox > img 6
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt

    r269628 r270116  
    99PASS .flexbox > img 2
    1010PASS .flexbox > img 3
    11 FAIL .flexbox > img 4 assert_equals:
    12 <img src="support/solidblue.png" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="30">
    13 width expected 30 but got 16
     11PASS .flexbox > img 4
    1412PASS .flexbox > img 5
    1513PASS .flexbox > img 6
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt

    r269628 r270116  
    66
    77
    8 FAIL .flexbox > img 1 assert_equals:
    9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40">
    10 height expected 40 but got 16
     8PASS .flexbox > img 1
    119PASS .flexbox > img 2
    1210PASS .flexbox > img 3
    13 FAIL .flexbox > img 4 assert_equals:
    14 <img src="support/solidblue.png" style="flex: 1 1 30px" data-expected-width="40" data-expected-height="40">
    15 height expected 40 but got 16
    16 FAIL .flexbox > img 5 assert_equals:
    17 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40">
    18 height expected 40 but got 34
    19 FAIL .flexbox > img 6 assert_equals:
    20 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40">
    21 height expected 40 but got 34
    22 FAIL .flexbox > img 7 assert_equals:
    23 <img src="support/solidblue.png" style="min-width: 30px;
    24                                               min-height: 34px" data-expected-width="40" data-expected-height="40">
    25 height expected 40 but got 34
    26 FAIL .flexbox > img 8 assert_equals:
    27 <img src="support/solidblue.png" style="min-width: 34px;
    28                                               min-height: 30px" data-expected-width="40" data-expected-height="40">
    29 height expected 40 but got 34
     11PASS .flexbox > img 4
     12PASS .flexbox > img 5
     13PASS .flexbox > img 6
     14PASS .flexbox > img 7
     15PASS .flexbox > img 8
    3016PASS .flexbox > img 9
    3117PASS .flexbox > img 10
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt

    r269628 r270116  
    66
    77
    8 FAIL .flexbox > img 1 assert_equals:
    9 <img src="support/solidblue.png" data-expected-width="40" data-expected-height="40">
    10 width expected 40 but got 16
     8PASS .flexbox > img 1
    119PASS .flexbox > img 2
    1210PASS .flexbox > img 3
    13 FAIL .flexbox > img 4 assert_equals:
    14 <img src="support/solidblue.png" style="flex: 1 1 30px" data-expected-width="40" data-expected-height="40">
    15 width expected 40 but got 16
    16 FAIL .flexbox > img 5 assert_equals:
    17 <img src="support/solidblue.png" style="min-width: 34px" data-expected-width="40" data-expected-height="40">
    18 width expected 40 but got 34
    19 FAIL .flexbox > img 6 assert_equals:
    20 <img src="support/solidblue.png" style="min-height: 34px" data-expected-width="40" data-expected-height="40">
    21 width expected 40 but got 34
    22 FAIL .flexbox > img 7 assert_equals:
    23 <img src="support/solidblue.png" style="min-width: 30px;
    24                                               min-height: 34px" data-expected-width="40" data-expected-height="40">
    25 width expected 40 but got 34
    26 FAIL .flexbox > img 8 assert_equals:
    27 <img src="support/solidblue.png" style="min-width: 34px;
    28                                               min-height: 30px" data-expected-width="40" data-expected-height="40">
    29 width expected 40 but got 34
     11PASS .flexbox > img 4
     12PASS .flexbox > img 5
     13PASS .flexbox > img 6
     14PASS .flexbox > img 7
     15PASS .flexbox > img 8
    3016PASS .flexbox > img 9
    3117PASS .flexbox > img 10
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt

    r269628 r270116  
    1111<img src="support/solidblue.png" style="height: 30px" data-expected-width="32" data-expected-height="30">
    1212width expected 32 but got 30
    13 FAIL .flexbox > img 4 assert_equals:
    14 <img src="support/solidblue.png" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="28">
    15 height expected 28 but got 20
     13PASS .flexbox > img 4
    1614PASS .flexbox > img 5
    1715PASS .flexbox > img 6
  • trunk/Source/WebCore/ChangeLog

    r270115 r270116  
     12020-11-20  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [css-flex] Images as flex items should use the overridingLogicalWidth when defined to compute the logical height
     4        https://bugs.webkit.org/show_bug.cgi?id=219195
     5
     6        Reviewed by Manuel Rego Casasnovas.
     7
     8        This is the same fix than the one we did in r270073 but for the other axis. RenderReplaced should use the overridingLogicalWidth
     9        whenever defined instead of the specified logical width to compute the logical height using an intrinsic aspect ratio.
     10        The overriding width is set by flex containers that need to stretch/shrink their items. The current code was not considering
     11        this case and thus, the intrinsic (non-stretched) logical height was used to compute the logical width,
     12        meaning that the stretching set by the flexbox container was ignored.
     13
     14        This patch allows WebKit to pass 15 subtests in already existing aspect ratio flexbox tests from WPT.
     15
     16        * rendering/RenderReplaced.cpp:
     17        (WebCore::RenderReplaced::computeReplacedLogicalHeight const): Use the overriding logical width if defined in presence of a valid aspect ratio.
     18
    1192020-11-20  Don Olmstead  <don.olmstead@sony.com>
    220
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r270073 r270116  
    582582    bool widthIsAuto = style().logicalWidth().isAuto();
    583583    bool hasIntrinsicHeight = constrainedSize.height() > 0;
     584    bool hasIntrinsicWidth = constrainedSize.width() > 0;
     585
     586    // See computeReplacedLogicalHeight() for a similar check for heights.
     587    if (intrinsicRatio && isFlexItem() && hasOverridingLogicalWidth() && hasIntrinsicHeight && hasIntrinsicWidth)
     588        return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(overridingContentLogicalWidth() / intrinsicRatio)));
    584589
    585590    // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'.
Note: See TracChangeset for help on using the changeset viewer.