Title: [205954] trunk
Revision
205954
Author
svil...@igalia.com
Date
2016-09-15 00:40:20 -0700 (Thu, 15 Sep 2016)

Log Message

[css-grid] Too many gaps with trailing collapsing tracks
https://bugs.webkit.org/show_bug.cgi?id=161905

Reviewed by Darin Adler.

Source/WebCore:

The total number and size of gaps were incorrectly computed whenever there were trailing
collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
much the amount of hash table queries required to know the gaps between two lines. We were
considering that a gap always exist between 2 consecutive tracks if the first one is not
empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
sequences) but not for all the cases (NOTEMPTY|EMPTY+).

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

LayoutTests:

Added new test cases to check that trailing collapsed tracks do not add gutters at the end.

* fast/css-grid-layout/grid-auto-fit-columns-expected.txt:
* fast/css-grid-layout/grid-auto-fit-columns.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205953 => 205954)


--- trunk/LayoutTests/ChangeLog	2016-09-15 07:21:18 UTC (rev 205953)
+++ trunk/LayoutTests/ChangeLog	2016-09-15 07:40:20 UTC (rev 205954)
@@ -1,3 +1,15 @@
+2016-09-13  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-grid] Too many gaps with trailing collapsing tracks
+        https://bugs.webkit.org/show_bug.cgi?id=161905
+
+        Reviewed by Darin Adler.
+
+        Added new test cases to check that trailing collapsed tracks do not add gutters at the end.
+
+        * fast/css-grid-layout/grid-auto-fit-columns-expected.txt:
+        * fast/css-grid-layout/grid-auto-fit-columns.html:
+
 2016-09-15  Youenn Fablet  <you...@apple.com>
 
         callPromiseFunction should be made usable for custom binding code

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns-expected.txt (205953 => 205954)


--- trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns-expected.txt	2016-09-15 07:21:18 UTC (rev 205953)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns-expected.txt	2016-09-15 07:40:20 UTC (rev 205954)
@@ -29,3 +29,5 @@
 PASS
 PASS
 PASS
+PASS
+PASS

Modified: trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns.html (205953 => 205954)


--- trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns.html	2016-09-15 07:21:18 UTC (rev 205953)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns.html	2016-09-15 07:40:20 UTC (rev 205954)
@@ -18,6 +18,7 @@
 .gridAutoRepeatAndFixed { grid-template-columns: [start] repeat(2, 50px [a]) [middle] repeat(auto-fit, [autofoo] 15px [autobar]) minmax(5%, 10%) [end]; }
 .gridMultipleNames { grid-template-columns: [start] 20px [foo] 50% repeat(auto-fit, [bar] 20px [start foo]) [foo] 10% [end bar]; }
 .gridMultipleTracks { grid-template-columns: [start] 20px repeat(auto-fit, [a] 2em [b c] 10% [d]) [e] minmax(75px, 1fr) [last]; }
+.gridMinMaxFixedFlex { grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); }
 
 .item { background-color: cyan; }
 .item:nth-child(2n) { background-color: green; }
@@ -150,4 +151,13 @@
     <div class="item" style="grid-column: c / -1;"  data-offset-x="40" data-offset-y="0" data-expected-width="160" data-expected-height="25"></div>
 </div>
 
+<div class="grid gridMinMaxFixedFlex gap">
+    <div class="item" style="grid-column-start: 1" data-offset-x="0" data-offset-y="0" data-expected-width="200" data-expected-height="25"></div>
+</div>
+
+<div class="grid gridMinMaxFixedFlex gap">
+    <div class="item" style="grid-column-start: 1" data-offset-x="0" data-offset-y="0" data-expected-width="90" data-expected-height="25"></div>
+    <div class="item" style="grid-column-start: 2" data-offset-x="110" data-offset-y="0" data-expected-width="90" data-expected-height="25"></div>
+</div>
+
 </body>

Modified: trunk/Source/WebCore/ChangeLog (205953 => 205954)


--- trunk/Source/WebCore/ChangeLog	2016-09-15 07:21:18 UTC (rev 205953)
+++ trunk/Source/WebCore/ChangeLog	2016-09-15 07:40:20 UTC (rev 205954)
@@ -1,3 +1,20 @@
+2016-09-13  Sergio Villar Senin  <svil...@igalia.com>
+
+        [css-grid] Too many gaps with trailing collapsing tracks
+        https://bugs.webkit.org/show_bug.cgi?id=161905
+
+        Reviewed by Darin Adler.
+
+        The total number and size of gaps were incorrectly computed whenever there were trailing
+        collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
+        much the amount of hash table queries required to know the gaps between two lines. We were
+        considering that a gap always exist between 2 consecutive tracks if the first one is not
+        empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
+        sequences) but not for all the cases (NOTEMPTY|EMPTY+).
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::guttersSize):
+
 2016-09-15  Youenn Fablet  <you...@apple.com>
 
         callPromiseFunction should be made usable for custom binding code

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (205953 => 205954)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-09-15 07:21:18 UTC (rev 205953)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-09-15 07:40:20 UTC (rev 205954)
@@ -546,6 +546,12 @@
             gapAccumulator += gap;
     }
 
+    // The above loop adds one extra gap for trailing collapsed tracks.
+    if (gapAccumulator && isEmptyAutoRepeatTrack(direction, endLine - 1)) {
+        ASSERT(gapAccumulator >= gap);
+        gapAccumulator -= gap;
+    }
+
     // If the startLine is the start line of a collapsed track we need to go backwards till we reach
     // a non collapsed track. If we find a non collapsed track we need to add that gap.
     if (startLine && isEmptyAutoRepeatTrack(direction, startLine)) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to