Title: [282804] trunk
Revision
282804
Author
[email protected]
Date
2021-09-21 00:26:24 -0700 (Tue, 21 Sep 2021)

Log Message

[css-grid] When the max is less than the min in minmax(), the max will be floored by the min
https://bugs.webkit.org/show_bug.cgi?id=230481

Reviewed by Sergio Villar Senin.

LayoutTests/imported/w3c:

Updated test expectation files as all the tests are passing.

* web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-columns-001-expected.txt:
* web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-rows-001-expected.txt:
* web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-columns-001-expected.txt:
* web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-rows-001-expected.txt:

Source/WebCore:

As per discussions in https://github.com/w3c/csswg-drafts/issues/4043, when the max is less than
the min in minmax()we need to floor the max track sizing function by the min track sizing function
when calculating the number of "auto-fit" or "auto-fill" repetitions. This change handles the
situations such as
  -  If both the min and max track sizing functions are definite, use the maximum of them
  -  If only one track sizing function is definite, use that one

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeAutoRepeatTracksCount const):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282803 => 282804)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-21 07:26:24 UTC (rev 282804)
@@ -1,3 +1,17 @@
+2021-09-21  Ziran Sun  <[email protected]>
+
+        [css-grid] When the max is less than the min in minmax(), the max will be floored by the min
+        https://bugs.webkit.org/show_bug.cgi?id=230481
+
+        Reviewed by Sergio Villar Senin.
+
+        Updated test expectation files as all the tests are passing.
+
+        * web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-columns-001-expected.txt:
+        * web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-rows-001-expected.txt:
+        * web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-columns-001-expected.txt:
+        * web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-rows-001-expected.txt:
+
 2021-09-21  Youenn Fablet  <[email protected]>
 
         Update list of WebRTC senders and receivers when updating local or remote descriptions

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-columns-001-expected.txt (282803 => 282804)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-columns-001-expected.txt	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-columns-001-expected.txt	2021-09-21 07:26:24 UTC (rev 282804)
@@ -2,16 +2,8 @@
 PASS .grid 1
 PASS .grid 2
 PASS .grid 3
-FAIL .grid 4 assert_equals:
-<div class="grid gridMaxMinAutoRepeat">
-    <div class="item" style="grid-column: 1 / -1" data-offset-x="0" data-offset-y="0" data-expected-width="180" data-expected-height="25"></div>
-</div>
-width expected 180 but got 450
-FAIL .grid 5 assert_equals:
-<div class="grid gridMaxMinPercentAutoRepeat">
-    <div class="item" style="grid-column: 1 / -1" data-offset-x="0" data-offset-y="0" data-expected-width="180" data-expected-height="25"></div>
-</div>
-width expected 180 but got 450
+PASS .grid 4
+PASS .grid 5
 PASS .grid 6
 PASS .grid 7
 PASS .grid 8

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-rows-001-expected.txt (282803 => 282804)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-rows-001-expected.txt	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fill-rows-001-expected.txt	2021-09-21 07:26:24 UTC (rev 282804)
@@ -2,16 +2,8 @@
 PASS .grid 1
 PASS .grid 2
 PASS .grid 3
-FAIL .grid 4 assert_equals:
-<div class="grid gridMaxMinAutoRepeat">
-    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
-</div>
-height expected 180 but got 450
-FAIL .grid 5 assert_equals:
-<div class="grid gridMaxMinPercentAutoRepeat">
-    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
-</div>
-height expected 180 but got 450
+PASS .grid 4
+PASS .grid 5
 PASS .grid 6
 PASS .grid 7
 PASS .grid 8

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-columns-001-expected.txt (282803 => 282804)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-columns-001-expected.txt	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-columns-001-expected.txt	2021-09-21 07:26:24 UTC (rev 282804)
@@ -2,16 +2,8 @@
 PASS .grid 1
 PASS .grid 2
 PASS .grid 3
-FAIL .grid 4 assert_equals:
-<div class="grid gridMaxMinAutoRepeat">
-    <div class="item" style="grid-column: 1 / -1" data-offset-x="0" data-offset-y="0" data-expected-width="180" data-expected-height="25"></div>
-</div>
-width expected 180 but got 450
-FAIL .grid 5 assert_equals:
-<div class="grid gridMaxMinPercentAutoRepeat">
-    <div class="item" style="grid-column: 1 / -1" data-offset-x="0" data-offset-y="0" data-expected-width="180" data-expected-height="25"></div>
-</div>
-width expected 180 but got 450
+PASS .grid 4
+PASS .grid 5
 PASS .grid 6
 PASS .grid 7
 PASS .grid 8

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-rows-001-expected.txt (282803 => 282804)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-rows-001-expected.txt	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-fit-rows-001-expected.txt	2021-09-21 07:26:24 UTC (rev 282804)
@@ -2,16 +2,8 @@
 PASS .grid 1
 PASS .grid 2
 PASS .grid 3
-FAIL .grid 4 assert_equals:
-<div class="grid gridMaxMinAutoRepeat">
-    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
-</div>
-height expected 180 but got 450
-FAIL .grid 5 assert_equals:
-<div class="grid gridMaxMinPercentAutoRepeat">
-    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
-</div>
-height expected 180 but got 450
+PASS .grid 4
+PASS .grid 5
 PASS .grid 6
 PASS .grid 7
 PASS .grid 8

Modified: trunk/Source/WebCore/ChangeLog (282803 => 282804)


--- trunk/Source/WebCore/ChangeLog	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/Source/WebCore/ChangeLog	2021-09-21 07:26:24 UTC (rev 282804)
@@ -1,3 +1,20 @@
+2021-09-21  Ziran Sun  <[email protected]>
+
+        [css-grid] When the max is less than the min in minmax(), the max will be floored by the min
+        https://bugs.webkit.org/show_bug.cgi?id=230481
+
+        Reviewed by Sergio Villar Senin.
+
+        As per discussions in https://github.com/w3c/csswg-drafts/issues/4043, when the max is less than
+        the min in minmax()we need to floor the max track sizing function by the min track sizing function
+        when calculating the number of "auto-fit" or "auto-fill" repetitions. This change handles the
+        situations such as
+          -  If both the min and max track sizing functions are definite, use the maximum of them
+          -  If only one track sizing function is definite, use that one
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
+
 2021-09-21  Youenn Fablet  <[email protected]>
 
         Update list of WebRTC senders and receivers when updating local or remote descriptions

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (282803 => 282804)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-09-21 07:18:03 UTC (rev 282803)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2021-09-21 07:26:24 UTC (rev 282804)
@@ -501,6 +501,9 @@
         ASSERT(!autoTrackSize.minTrackBreadth().isFlex());
         bool hasDefiniteMaxTrackSizingFunction = autoTrackSize.maxTrackBreadth().isLength() && !autoTrackSize.maxTrackBreadth().isContentSized();
         auto trackLength = hasDefiniteMaxTrackSizingFunction ? autoTrackSize.maxTrackBreadth().length() : autoTrackSize.minTrackBreadth().length();
+        bool hasDefiniteMinTrackSizingFunction = autoTrackSize.minTrackBreadth().isLength() && !autoTrackSize.minTrackBreadth().isContentSized();
+        if (hasDefiniteMinTrackSizingFunction && (trackLength.value() < autoTrackSize.minTrackBreadth().length().value()))
+            trackLength = autoTrackSize.minTrackBreadth().length();
         autoRepeatTracksSize += valueForLength(trackLength, availableSize.value());
     }
     // For the purpose of finding the number of auto-repeated tracks, the UA must floor the track size to a UA-specified
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to