Title: [262411] trunk
Revision
262411
Author
svil...@igalia.com
Date
2020-06-02 04:28:30 -0700 (Tue, 02 Jun 2020)

Log Message

[css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content
https://bugs.webkit.org/show_bug.cgi?id=210465

Reviewed by Javier Fernandez.

Source/WebCore:

When computing the hypothetical cross size of each item in the flexbox algorithm
the current code was using the max-size. However the specs state clearly that we
should use fit-content instead, i.e., the shrink-to-fit size.
See https://drafts.csswg.org/css-flexbox/#algo-cross-item.

Based on Blink's crrev.com/1327746 by <cbiesin...@chromium.org>

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Use the shrink-to-fit
size instead just the max-size.

LayoutTests:

* TestExpectations: Unskipped flex-wrap-002.html which is now passing.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262410 => 262411)


--- trunk/LayoutTests/ChangeLog	2020-06-02 11:24:19 UTC (rev 262410)
+++ trunk/LayoutTests/ChangeLog	2020-06-02 11:28:30 UTC (rev 262411)
@@ -1,3 +1,12 @@
+2020-06-01  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content
+        https://bugs.webkit.org/show_bug.cgi?id=210465
+
+        Reviewed by Javier Fernandez.
+
+        * TestExpectations: Unskipped flex-wrap-002.html which is now passing.
+
 2020-06-02  Youenn Fablet  <you...@apple.com>
 
         [ Mac wk2 ] http/wpt/service-workers/service-worker-spinning-fetch.https.html is flaky failing.

Modified: trunk/LayoutTests/TestExpectations (262410 => 262411)


--- trunk/LayoutTests/TestExpectations	2020-06-02 11:24:19 UTC (rev 262410)
+++ trunk/LayoutTests/TestExpectations	2020-06-02 11:28:30 UTC (rev 262411)
@@ -4243,7 +4243,6 @@
 webkit.org/b/210093 imported/w3c/web-platform-tests/css/css-flexbox/select-element-zero-height-001.html [ ImageOnlyFailure ]
 webkit.org/b/210093 imported/w3c/web-platform-tests/css/css-flexbox/select-element-zero-height-002.html [ ImageOnlyFailure ]
 webkit.org/b/210144 imported/w3c/web-platform-tests/css/css-flexbox/anonymous-flex-item-005.html [ ImageOnlyFailure ]
-webkit.org/b/210465 imported/w3c/web-platform-tests/css/css-flexbox/flex-wrap-002.html [ ImageOnlyFailure ]
 webkit.org/b/210475 imported/w3c/web-platform-tests/css/css-flexbox/image-items-flake-001.html [ ImageOnlyFailure ]
 webkit.org/b/210478 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-006.html [ ImageOnlyFailure ]
 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/flex-minimum-height-flex-items-005.xht [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (262410 => 262411)


--- trunk/Source/WebCore/ChangeLog	2020-06-02 11:24:19 UTC (rev 262410)
+++ trunk/Source/WebCore/ChangeLog	2020-06-02 11:28:30 UTC (rev 262411)
@@ -1,3 +1,21 @@
+2020-06-01  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-flexbox] ChildIntrinsicLogicalWidth should use fit-content, not max-content
+        https://bugs.webkit.org/show_bug.cgi?id=210465
+
+        Reviewed by Javier Fernandez.
+
+        When computing the hypothetical cross size of each item in the flexbox algorithm
+        the current code was using the max-size. However the specs state clearly that we
+        should use fit-content instead, i.e., the shrink-to-fit size.
+        See https://drafts.csswg.org/css-flexbox/#algo-cross-item.
+
+        Based on Blink's crrev.com/1327746 by <cbiesin...@chromium.org>
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Use the shrink-to-fit
+        size instead just the max-size.
+
 2020-06-02  Youenn Fablet  <you...@apple.com>
 
         MediaPlayerPrivateMediaStreamAVFObjC should enqueue samples in a background thread

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (262410 => 262411)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-06-02 11:24:19 UTC (rev 262410)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-06-02 11:28:30 UTC (rev 262411)
@@ -467,9 +467,10 @@
     // This should only be called if the logical width is the cross size
     ASSERT(hasOrthogonalFlow(child));
     // If our height is auto, make sure that our returned height is unaffected by
-    // earlier layouts by returning the max preferred logical width
+    // earlier layouts by returning the shrink-to-fit size.
     if (!crossAxisLengthIsDefinite(child, child.style().logicalWidth()))
-        return child.maxPreferredLogicalWidth();
+        return std::min(child.maxPreferredLogicalWidth(), std::max(child.minPreferredLogicalWidth(), contentLogicalWidth()));
+
     return child.logicalWidth();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to