Title: [206310] trunk
Revision
206310
Author
[email protected]
Date
2016-09-23 09:29:43 -0700 (Fri, 23 Sep 2016)

Log Message

[css-grid] ASSERT when sizing tracks with percentages inside calc
https://bugs.webkit.org/show_bug.cgi?id=162383

Reviewed by Darin Adler.

Source/WebCore:

There is an ASSERT to check that tracks are at least as wide as the initial base size. This
was added to verify that we never shrink tracks bellow that value. In order to compute the
value used for initialization we need a max size which is the value used to resolve
percentages to. The remaining free space was used to compute that value, that's totally
wrong because the free space decreases as the track sizing algorithm is run. The available
space should be used instead.

An extra ASSERT was removed too because it was redundant, we do always check the sizes of
the tracks after running the track sizing algorithm and that's precisely the unique point
were they could be modified.

Test: fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html

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

LayoutTests:

* fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt: Added.
* fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206309 => 206310)


--- trunk/LayoutTests/ChangeLog	2016-09-23 16:25:42 UTC (rev 206309)
+++ trunk/LayoutTests/ChangeLog	2016-09-23 16:29:43 UTC (rev 206310)
@@ -1,3 +1,13 @@
+2016-09-22  Sergio Villar Senin  <[email protected]>
+
+        [css-grid] ASSERT when sizing tracks with percentages inside calc
+        https://bugs.webkit.org/show_bug.cgi?id=162383
+
+        Reviewed by Darin Adler.
+
+        * fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt: Added.
+        * fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html: Added.
+
 2016-09-23  Chris Dumez  <[email protected]>
 
         document.title getter does not strip / collapse the right whitespace characters

Added: trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt (0 => 206310)


--- trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt	2016-09-23 16:29:43 UTC (rev 206310)
@@ -0,0 +1,3 @@
+The test PASS if it does not trigger an ASSERT on Debug builds.
+
+
Property changes on: trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html (0 => 206310)


--- trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html	2016-09-23 16:29:43 UTC (rev 206310)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<link href='' rel='stylesheet'>
+<style>
+.grid {
+  height: 100px;
+  grid-template-rows: calc(10px - 5%);
+}
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+
+<p>The test PASS if it does not trigger an ASSERT on Debug builds.</p>
+<div class="grid"></div>
Property changes on: trunk/LayoutTests/fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Modified: trunk/Source/WebCore/ChangeLog (206309 => 206310)


--- trunk/Source/WebCore/ChangeLog	2016-09-23 16:25:42 UTC (rev 206309)
+++ trunk/Source/WebCore/ChangeLog	2016-09-23 16:29:43 UTC (rev 206310)
@@ -1,3 +1,26 @@
+2016-09-22  Sergio Villar Senin  <[email protected]>
+
+        [css-grid] ASSERT when sizing tracks with percentages inside calc
+        https://bugs.webkit.org/show_bug.cgi?id=162383
+
+        Reviewed by Darin Adler.
+
+        There is an ASSERT to check that tracks are at least as wide as the initial base size. This
+        was added to verify that we never shrink tracks bellow that value. In order to compute the
+        value used for initialization we need a max size which is the value used to resolve
+        percentages to. The remaining free space was used to compute that value, that's totally
+        wrong because the free space decreases as the track sizing algorithm is run. The available
+        space should be used instead.
+
+        An extra ASSERT was removed too because it was redundant, we do always check the sizes of
+        the tracks after running the track sizing algorithm and that's precisely the unique point
+        were they could be modified.
+
+        Test: fast/css-grid-layout/tracks-wider-min-track-breadth-crash.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
+
 2016-09-23  Chris Dumez  <[email protected]>
 
         document.title getter does not strip / collapse the right whitespace characters

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (206309 => 206310)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-09-23 16:25:42 UTC (rev 206309)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2016-09-23 16:29:43 UTC (rev 206310)
@@ -630,7 +630,6 @@
 void RenderGrid::computeIntrinsicLogicalHeight(GridSizingData& sizingData)
 {
     ASSERT(sizingData.isValidTransition(ForRows));
-    ASSERT(tracksAreWiderThanMinTrackBreadth(ForColumns, sizingData));
     sizingData.setAvailableSpace(Nullopt);
     sizingData.setFreeSpace(ForRows, Nullopt);
     sizingData.sizingOperation = IntrinsicSizeComputation;
@@ -1439,7 +1438,7 @@
 bool RenderGrid::tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection direction, GridSizingData& sizingData)
 {
     const Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTracks : sizingData.rowTracks;
-    const LayoutUnit maxSize = sizingData.freeSpace(direction).valueOr(0);
+    const LayoutUnit maxSize = sizingData.availableSpace().valueOr(0);
     for (unsigned i = 0; i < tracks.size(); ++i) {
         const GridTrackSize& trackSize = gridTrackSize(direction, i, sizingData.sizingOperation);
         if (computeUsedBreadthOfMinLength(trackSize, maxSize) > tracks[i].baseSize())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to