Title: [207457] trunk
Revision
207457
Author
svil...@igalia.com
Date
2016-10-18 02:21:58 -0700 (Tue, 18 Oct 2016)

Log Message

[css-grid] Constrain by min|max-height on auto repeat computation
https://bugs.webkit.org/show_bug.cgi?id=163540

Reviewed by Darin Adler.

Source/WebCore:

The max-height (if definite) is used to compute the number of auto repeat rows whenever the
height is indefinite. We were using the min-height only in case both values were indefinite.

Although not explicitly mentioned by grid specs, it's reasonable to assume that
the min-height trumps the used value of height/max-height like it always does, per CSS
2.2. Note that the number of rows still needs to fit within that size even if using
min-height, because we're just using min-height to compute the used value of the height
property. If both height and max-height are indefinite we keep doing the same, i.e., compute
the minimum number of rows that fulfill min-height (if definite).

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

LayoutTests:

Some new test cases to verify that min-height is used on the auto repeat tracks computation
whenever the height is indefinite and max-height is not.

* fast/css-grid-layout/grid-auto-fill-rows-expected.txt:
* fast/css-grid-layout/grid-auto-fill-rows.html:
* fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash-expected.txt:
* fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207456 => 207457)


--- trunk/LayoutTests/ChangeLog	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/LayoutTests/ChangeLog	2016-10-18 09:21:58 UTC (rev 207457)
@@ -1,3 +1,18 @@
+2016-10-17  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-grid] Constrain by min|max-height on auto repeat computation
+        https://bugs.webkit.org/show_bug.cgi?id=163540
+
+        Reviewed by Darin Adler.
+
+        Some new test cases to verify that min-height is used on the auto repeat tracks computation
+        whenever the height is indefinite and max-height is not.
+
+        * fast/css-grid-layout/grid-auto-fill-rows-expected.txt:
+        * fast/css-grid-layout/grid-auto-fill-rows.html:
+        * fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash-expected.txt:
+        * fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash.html:
+
 2016-10-17  Megan Gardner  <megan_gard...@apple.com>
 
         Add test and infrastructure for link popover

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows-expected.txt (207456 => 207457)


--- trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows-expected.txt	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows-expected.txt	2016-10-18 09:21:58 UTC (rev 207457)
@@ -29,3 +29,5 @@
 PASS
 PASS
 PASS
+PASS
+PASS

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows.html (207456 => 207457)


--- trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows.html	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-auto-fill-rows.html	2016-10-18 09:21:58 UTC (rev 207457)
@@ -23,7 +23,9 @@
 .gridMultipleNames { grid-template-rows: [start] 20px [foo] 50% repeat(auto-fill, [bar] 20px [start foo]) [foo] 10% [end bar]; }
 .gridMultipleTracks { grid-template-rows: [start] 20px repeat(auto-fill, [a] 2em [b c] 10% [d]) [e] minmax(75px, 1fr) [last]; }
 
-.item { background-color: cyan; }
+.item { background-color: blue; }
+.item:nth-child(2) { background: green; }
+.item:nth-child(3) { background: orange; }
 
 .gap { grid-row-gap: 20px; }
 
@@ -51,6 +53,18 @@
     <div class="item" style="grid-row: autobar 2 / span 3" data-offset-y="100" data-offset-x="0" data-expected-height="257" data-expected-width="25"></div>
 </div>
 
+<div class="grid gridOnlyAutoRepeat gap" style="height: auto; max-height: 90px;" data-expected-height="94" data-expected-width="29">
+    <div class="item" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+    <div class="item" data-offset-y="50" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+    <div class="item" data-offset-y="100" data-offset-x="0" data-expected-height="157" data-expected-width="25"></div>
+</div>
+
+<div class="grid gridOnlyAutoRepeat gap" style="height: auto; max-height: 90px; min-height: 130px;" data-expected-height="134" data-expected-width="29">
+    <div class="item" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+    <div class="item" data-offset-y="50" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+    <div class="item" data-offset-y="100" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
+</div>
+
 <div class="grid gridAutoRepeatAndFixedBefore">
     <div class="item" style="grid-row: 1 / span 6" data-offset-y="0" data-offset-x="0" data-expected-height="190" data-expected-width="25"></div>
 </div>

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash-expected.txt (207456 => 207457)


--- trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash-expected.txt	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash-expected.txt	2016-10-18 09:21:58 UTC (rev 207457)
@@ -8,6 +8,16 @@
 item
 item
 item
+item
+item
+item
+item
+item
+item
+item
+item
+item
+item
 This test checks that the computation of auto repeat tracks works when the grid container width is indefinite.
 
 This test has PASSED if it didn't CRASH.

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash.html (207456 => 207457)


--- trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash.html	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-indefinite-size-auto-repeat-crash.html	2016-10-18 09:21:58 UTC (rev 207457)
@@ -42,5 +42,85 @@
 <div class="grid autoFill min-width-max-content min-height-max-content">item</div>
 <div class="grid autoFit min-width-max-content min-height-max-content">item</div>
 
+<div class="min-height-max-content min-width-min-content">
+    <div class="grid autoFill"></div>
+</div>
+
+<div class="max-content">
+    <div class="grid autoFit"></div>
+</div>
+
+<div class="min-content min-width-min-content">
+    <div class="grid autoFill"></div>
+</div>
+
+<div class="max-content max-width-min-content">
+    <div class="grid autoFit"></div>
+</div>
+
+<div class="min-height-max-content min-content">
+    <div class="grid autoFill"></div>
+</div>
+
+<div class="min-height-min-content max-content">
+    <div class="grid autoFit"></div>
+</div>
+
+<div class="min-height-max-content min-width-min-content">
+    <div class="grid autoFill min-width-min-content"></div>
+</div>
+
+<div class="min-height-max-content min-width-min-content">
+    <div class="grid autoFit min-height-min-content"></div>
+</div>
+
+<div class="max-content min-width-min-content">
+    <div class="grid autoFill"></div>
+</div>
+
+<div class="max-height-min-content min-content">
+    <div class="grid autoFit max-height-max-content"></div>
+</div>
+
+<div class="min-height-max-content min-content">
+    <div class="grid autoFill">item</div>
+</div>
+
+<div class="min-height-min-content max-width-min-content">
+    <div class="grid autoFit">item</div>
+</div>
+
+<div class="max-height-max-content max-width-max-content">
+    <div class="grid autoFill max-width-min-content">item</div>
+</div>
+
+<div class="max-height-min-content min-content">
+    <div class="grid autoFit min-height-max-content max-height-min-content">item</div>
+</div>
+
+<div class="min-height-max-content max-content">
+    <div class="grid autoFill max-height-max-content">item</div>
+</div>
+
+<div class="min-content min-width-max-content">
+    <div class="grid autoFit max-width-max-content">item</div>
+</div>
+
+<div class="min-content max-width-max-content">
+    <div class="grid autoFill min-height-min-content">item</div>
+</div>
+
+<div class="min-height-min-content min-content">
+    <div class="grid autoFit max-height-min-content">item</div>
+</div>
+
+<div class="max-height-max-content max-content">
+    <div class="grid autoFill max-height-min-content">item</div>
+</div>
+
+<div class="min-content min-width-min-content">
+    <div class="grid autoFit min-content min-height-min-content max-height-max-content">item</div>
+</div>
+
 <p>This test checks that the computation of auto repeat tracks works when the grid container width is indefinite.</p>
 <p>This test has PASSED if it didn't CRASH.</p>

Modified: trunk/Source/WebCore/ChangeLog (207456 => 207457)


--- trunk/Source/WebCore/ChangeLog	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/Source/WebCore/ChangeLog	2016-10-18 09:21:58 UTC (rev 207457)
@@ -1,3 +1,23 @@
+2016-10-17  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-grid] Constrain by min|max-height on auto repeat computation
+        https://bugs.webkit.org/show_bug.cgi?id=163540
+
+        Reviewed by Darin Adler.
+
+        The max-height (if definite) is used to compute the number of auto repeat rows whenever the
+        height is indefinite. We were using the min-height only in case both values were indefinite.
+
+        Although not explicitly mentioned by grid specs, it's reasonable to assume that
+        the min-height trumps the used value of height/max-height like it always does, per CSS
+        2.2. Note that the number of rows still needs to fit within that size even if using
+        min-height, because we're just using min-height to compute the used value of the height
+        property. If both height and max-height are indefinite we keep doing the same, i.e., compute
+        the minimum number of rows that fulfill min-height (if definite).
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeAutoRepeatTracksCount):
+
 2016-10-17  Yusuke Suzuki  <utatane....@gmail.com>
 
         [DOMJIT] Use NativeCallFrameTracer for operations used for DOMJIT slow calls

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (207456 => 207457)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-10-18 08:13:26 UTC (rev 207456)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-10-18 09:21:58 UTC (rev 207457)
@@ -1488,14 +1488,14 @@
         if (sizingOperation != IntrinsicSizeComputation)
             availableSize =  availableLogicalWidth();
     } else {
-        availableSize = computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), LayoutUnit(-1));
+        availableSize = computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), Nullopt);
         if (!availableSize) {
             const Length& maxLength = style().logicalMaxHeight();
             if (!maxLength.isUndefined())
-                availableSize = computeContentLogicalHeight(MaxSize, maxLength, LayoutUnit(-1));
-        } else {
-            availableSize = constrainLogicalHeightByMinMax(availableSize.value(), LayoutUnit(-1));
+                availableSize = computeContentLogicalHeight(MaxSize, maxLength, Nullopt);
         }
+        if (availableSize)
+            availableSize = constrainContentBoxLogicalHeightByMinMax(availableSize.value(), Nullopt);
     }
 
     bool needsToFulfillMinimumSize = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to