Title: [270116] trunk
Revision
270116
Author
[email protected]
Date
2020-11-20 08:09:32 -0800 (Fri, 20 Nov 2020)

Log 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-20 16:09:32 UTC (rev 270116)
@@ -1,3 +1,18 @@
+2020-11-20  Sergio Villar Senin  <[email protected]>
+
+        [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.
+
+        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:
+
 2020-11-20  Chris Lord  <[email protected]>
 
         Enable font functions on OffscreenCanvas for main-thread

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-001-expected.txt	2020-11-20 16:09:32 UTC (rev 270116)
@@ -8,9 +8,7 @@
 PASS .flexbox > img 1
 PASS .flexbox > img 2
 PASS .flexbox > img 3
-FAIL .flexbox > img 4 assert_equals:
-<img src="" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="30">
-height expected 30 but got 16
+PASS .flexbox > img 4
 PASS .flexbox > img 5
 PASS .flexbox > img 6
 PASS .flexbox > img 7

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-002v-expected.txt	2020-11-20 16:09:32 UTC (rev 270116)
@@ -8,9 +8,7 @@
 PASS .flexbox > img 1
 PASS .flexbox > img 2
 PASS .flexbox > img 3
-FAIL .flexbox > img 4 assert_equals:
-<img src="" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="30">
-width expected 30 but got 16
+PASS .flexbox > img 4
 PASS .flexbox > img 5
 PASS .flexbox > img 6
 PASS .flexbox > img 7

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-005-expected.txt	2020-11-20 16:09:32 UTC (rev 270116)
@@ -5,28 +5,14 @@
 
 
 
-FAIL .flexbox > img 1 assert_equals:
-<img src="" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 16
+PASS .flexbox > img 1
 PASS .flexbox > img 2
 PASS .flexbox > img 3
-FAIL .flexbox > img 4 assert_equals:
-<img src="" style="flex: 1 1 30px" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 16
-FAIL .flexbox > img 5 assert_equals:
-<img src="" style="min-width: 34px" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 34
-FAIL .flexbox > img 6 assert_equals:
-<img src="" style="min-height: 34px" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 34
-FAIL .flexbox > img 7 assert_equals:
-<img src="" style="min-width: 30px;
-                                              min-height: 34px" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 34
-FAIL .flexbox > img 8 assert_equals:
-<img src="" style="min-width: 34px;
-                                              min-height: 30px" data-expected-width="40" data-expected-height="40">
-height expected 40 but got 34
+PASS .flexbox > img 4
+PASS .flexbox > img 5
+PASS .flexbox > img 6
+PASS .flexbox > img 7
+PASS .flexbox > img 8
 PASS .flexbox > img 9
 PASS .flexbox > img 10
 PASS .flexbox > img 11

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-006v-expected.txt	2020-11-20 16:09:32 UTC (rev 270116)
@@ -5,28 +5,14 @@
 
 
 
-FAIL .flexbox > img 1 assert_equals:
-<img src="" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 16
+PASS .flexbox > img 1
 PASS .flexbox > img 2
 PASS .flexbox > img 3
-FAIL .flexbox > img 4 assert_equals:
-<img src="" style="flex: 1 1 30px" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 16
-FAIL .flexbox > img 5 assert_equals:
-<img src="" style="min-width: 34px" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 34
-FAIL .flexbox > img 6 assert_equals:
-<img src="" style="min-height: 34px" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 34
-FAIL .flexbox > img 7 assert_equals:
-<img src="" style="min-width: 30px;
-                                              min-height: 34px" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 34
-FAIL .flexbox > img 8 assert_equals:
-<img src="" style="min-width: 34px;
-                                              min-height: 30px" data-expected-width="40" data-expected-height="40">
-width expected 40 but got 34
+PASS .flexbox > img 4
+PASS .flexbox > img 5
+PASS .flexbox > img 6
+PASS .flexbox > img 7
+PASS .flexbox > img 8
 PASS .flexbox > img 9
 PASS .flexbox > img 10
 PASS .flexbox > img 11

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt (270115 => 270116)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/image-as-flexitem-size-007-expected.txt	2020-11-20 16:09:32 UTC (rev 270116)
@@ -10,9 +10,7 @@
 FAIL .flexbox > img 3 assert_equals:
 <img src="" style="height: 30px" data-expected-width="32" data-expected-height="30">
 width expected 32 but got 30
-FAIL .flexbox > img 4 assert_equals:
-<img src="" style="flex: 0 0 30px" data-expected-width="30" data-expected-height="28">
-height expected 28 but got 20
+PASS .flexbox > img 4
 PASS .flexbox > img 5
 PASS .flexbox > img 6
 PASS .flexbox > img 7

Modified: trunk/Source/WebCore/ChangeLog (270115 => 270116)


--- trunk/Source/WebCore/ChangeLog	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/Source/WebCore/ChangeLog	2020-11-20 16:09:32 UTC (rev 270116)
@@ -1,3 +1,21 @@
+2020-11-20  Sergio Villar Senin  <[email protected]>
+
+        [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.
+
+        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.
+
 2020-11-20  Don Olmstead  <[email protected]>
 
         Use final in generated callback code

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (270115 => 270116)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2020-11-20 15:45:47 UTC (rev 270115)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2020-11-20 16:09:32 UTC (rev 270116)
@@ -581,7 +581,12 @@
 
     bool widthIsAuto = style().logicalWidth().isAuto();
     bool hasIntrinsicHeight = constrainedSize.height() > 0;
+    bool hasIntrinsicWidth = constrainedSize.width() > 0;
 
+    // See computeReplacedLogicalHeight() for a similar check for heights.
+    if (intrinsicRatio && isFlexItem() && hasOverridingLogicalWidth() && hasIntrinsicHeight && hasIntrinsicWidth)
+        return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(overridingContentLogicalWidth() / intrinsicRatio)));
+
     // 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'.
     if (widthIsAuto && hasIntrinsicHeight)
         return computeReplacedLogicalHeightRespectingMinMaxHeight(constrainedSize.height());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to