Title: [270288] trunk
Revision
270288
Author
[email protected]
Date
2020-12-01 01:21:49 -0800 (Tue, 01 Dec 2020)

Log Message

[css-flexbox] WebKit doesn't preserve aspect ratio when computing cross size of flexed images in auto-height flex container
https://bugs.webkit.org/show_bug.cgi?id=209983
<rdar://problem/61288094>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-flexbox/flexitem-stretch-image-expected.txt: Replace FAIL by PASS expectations.

Source/WebCore:

Aspect ratio was not preserved in the cross axis because WebKit was stretching the items (as they're auto sized) without considering
the aspect ratio. Instead of letting flexbox code deal with that we basically don't stretch them and let RenderReplaced compute the
cross size based on the aspect ratio as it does with other elements that are not flex items.

This allows us to pass 3 tests from the WPT test suite.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight const): Return false for replaced elements with aspect ratio.

LayoutTests:

* TestExpectations: Unskipped 2 tests that are working fine now
* css3/flexbox/flexitem.html: Updated expectations. Aspect ratio must be preserved.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (270287 => 270288)


--- trunk/LayoutTests/ChangeLog	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/LayoutTests/ChangeLog	2020-12-01 09:21:49 UTC (rev 270288)
@@ -1,3 +1,14 @@
+2020-12-01  Sergio Villar Senin  <[email protected]>
+
+        [css-flexbox] WebKit doesn't preserve aspect ratio when computing cross size of flexed images in auto-height flex container
+        https://bugs.webkit.org/show_bug.cgi?id=209983
+        <rdar://problem/61288094>
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations: Unskipped 2 tests that are working fine now
+        * css3/flexbox/flexitem.html: Updated expectations. Aspect ratio must be preserved.
+
 2020-12-01  Diego Pino Garcia  <[email protected]>
 
         [WPE] Unreviewed test gardening. Update WPE baselines of baselines updated r238731.

Modified: trunk/LayoutTests/TestExpectations (270287 => 270288)


--- trunk/LayoutTests/TestExpectations	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/LayoutTests/TestExpectations	2020-12-01 09:21:49 UTC (rev 270288)
@@ -3912,11 +3912,9 @@
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-017.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-006.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-007.html [ ImageOnlyFailure ]
-webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-008.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-009.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-010.html [ ImageOnlyFailure ]
 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-013.html [ ImageOnlyFailure ]
-webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-014.html [ ImageOnlyFailure ]
 
 webkit.org/b/145176 imported/w3c/web-platform-tests/css/css-flexbox/flexbox_align-items-stretch-3.html [ ImageOnlyFailure ]
 webkit.org/b/210093 imported/w3c/web-platform-tests/css/css-flexbox/select-element-zero-height-001.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/css3/flexbox/flexitem.html (270287 => 270288)


--- trunk/LayoutTests/css3/flexbox/flexitem.html	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/LayoutTests/css3/flexbox/flexitem.html	2020-12-01 09:21:49 UTC (rev 270288)
@@ -47,8 +47,8 @@
 
 <div class="flexbox">
   <img data-expected-display="block" data-expected-width="200" style="flex: 1 0 auto;" src=""
-  <img data-expected-display="block" data-expected-width="200" data-expected-height="100" style="flex: 2 0 0;" src=""
-  <img data-expected-display="block" data-expected-width="200" data-expected-height="100" style="flex: 2 0 0;" src="" alt="placeholder text">
+  <img data-expected-display="block" data-expected-width="200" data-expected-height="200" style="flex: 2 0 0;" src=""
+  <img data-expected-display="block" data-expected-width="200" data-expected-height="200" style="flex: 2 0 0;" src="" alt="placeholder text">
 </div>
 
 <div class="flexbox">

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (270287 => 270288)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-12-01 09:21:49 UTC (rev 270288)
@@ -1,3 +1,13 @@
+2020-12-01  Sergio Villar Senin  <[email protected]>
+
+        [css-flexbox] WebKit doesn't preserve aspect ratio when computing cross size of flexed images in auto-height flex container
+        https://bugs.webkit.org/show_bug.cgi?id=209983
+        <rdar://problem/61288094>
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/css/css-flexbox/flexitem-stretch-image-expected.txt: Replace FAIL by PASS expectations.
+
 2020-11-30  Alex Christensen  <[email protected]>
 
         Allow blob URLs with fragments

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexitem-stretch-image-expected.txt (270287 => 270288)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexitem-stretch-image-expected.txt	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flexitem-stretch-image-expected.txt	2020-12-01 09:21:49 UTC (rev 270288)
@@ -1,8 +1,3 @@
 
-FAIL .flexbox 1 assert_equals:
-<div class="flexbox">
-  <img data-expected-display="block" data-expected-width="345" data-expected-height="345" style="flex: 1 0 auto;" src=""
-  <img data-expected-display="block" data-expected-width="255" data-expected-height="345" style="flex: 1 0 auto;" src=""
-</div>
-height expected 345 but got 100
+PASS .flexbox 1
 

Modified: trunk/Source/WebCore/ChangeLog (270287 => 270288)


--- trunk/Source/WebCore/ChangeLog	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/Source/WebCore/ChangeLog	2020-12-01 09:21:49 UTC (rev 270288)
@@ -1,3 +1,20 @@
+2020-12-01  Sergio Villar Senin  <[email protected]>
+
+        [css-flexbox] WebKit doesn't preserve aspect ratio when computing cross size of flexed images in auto-height flex container
+        https://bugs.webkit.org/show_bug.cgi?id=209983
+        <rdar://problem/61288094>
+
+        Reviewed by Darin Adler.
+
+        Aspect ratio was not preserved in the cross axis because WebKit was stretching the items (as they're auto sized) without considering
+        the aspect ratio. Instead of letting flexbox code deal with that we basically don't stretch them and let RenderReplaced compute the
+        cross size based on the aspect ratio as it does with other elements that are not flex items.
+
+        This allows us to pass 3 tests from the WPT test suite.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight const): Return false for replaced elements with aspect ratio.
+
 2020-11-30  Andres Gonzalez  <[email protected]>
 
         [WebAccessibilityObjectWrapper doAXAttributedStringForRange] needs to run on the main thread.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (270287 => 270288)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-12-01 08:42:50 UTC (rev 270287)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-12-01 09:21:49 UTC (rev 270288)
@@ -1550,6 +1550,10 @@
     if (isHorizontalFlow() != child.style().isHorizontalWritingMode())
         return false;
 
+    // Aspect ratio is properly handled by RenderReplaced during layout.
+    if (child.isRenderReplaced() && child.hasAspectRatio())
+        return false;
+
     return child.style().logicalHeight().isAuto();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to