Title: [178497] releases/WebKitGTK/webkit-2.6
Revision
178497
Author
[email protected]
Date
2015-01-15 02:16:45 -0800 (Thu, 15 Jan 2015)

Log Message

Merge r174946 - ASSERTION FAILED: !gridWasPopulated() in WebCore::RenderGrid::placeItemsOnGrid
https://bugs.webkit.org/show_bug.cgi?id=136939

Reviewed by Darin Adler.

Source/WebCore:

In some particular situations computeIntrinsicLogicalWidths() is called
in the middle of layoutGridItems(). In these cases we do not need to
populate the grid again, so we should avoid calling placeItemsOnGrid().
In addition, we do not need to clean the grid either, as that will be
done later by layoutGridItems().

Test: fast/css-grid-layout/grid-was-populated-assert.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeIntrinsicLogicalWidths): Avoid calls to
placeItemsOnGrid() and clearGrid() if the grid was already populated.
* rendering/RenderGrid.h: Move gridWasPopulated() header out of the
debug ifdefs.

LayoutTests:

Added a test case to reproduce the crash in debug mode.

* fast/css-grid-layout/grid-was-populated-assert-expected.txt: Added.
* fast/css-grid-layout/grid-was-populated-assert.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog (178496 => 178497)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog	2015-01-15 09:04:38 UTC (rev 178496)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/ChangeLog	2015-01-15 10:16:45 UTC (rev 178497)
@@ -1,3 +1,15 @@
+2014-10-21  Manuel Rego Casasnovas  <[email protected]>
+
+        ASSERTION FAILED: !gridWasPopulated() in WebCore::RenderGrid::placeItemsOnGrid
+        https://bugs.webkit.org/show_bug.cgi?id=136939
+
+        Reviewed by Darin Adler.
+
+        Added a test case to reproduce the crash in debug mode.
+
+        * fast/css-grid-layout/grid-was-populated-assert-expected.txt: Added.
+        * fast/css-grid-layout/grid-was-populated-assert.html: Added.
+
 2015-01-09  Zalan Bujtas  <[email protected]>
 
         Calling clearSelection on a detached RenderObject leads to segfault.

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert-expected.txt (0 => 178497)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert-expected.txt	2015-01-15 10:16:45 UTC (rev 178497)
@@ -0,0 +1,4 @@
+This test passes if it does not crash in debug mode.
+
+
+

Added: releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert.html (0 => 178497)


--- releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.6/LayoutTests/fast/css-grid-layout/grid-was-populated-assert.html	2015-01-15 10:16:45 UTC (rev 178497)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+    }
+    </script>
+    <style>
+    details {
+        display: -webkit-grid;
+        -webkit-columns: 5;
+    }
+    div {
+        display: -webkit-grid;
+    }
+    input {
+        -webkit-columns: 5;
+    }
+    </style>
+</head>
+<body>
+    <p>This test passes if it does not crash in debug mode.</p>
+    <details open>
+        <button>
+            <div>
+                <input placeholder="testing" />
+            </div>
+        </button>
+    </details>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (178496 => 178497)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2015-01-15 09:04:38 UTC (rev 178496)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2015-01-15 10:16:45 UTC (rev 178497)
@@ -1,3 +1,24 @@
+2014-10-21  Manuel Rego Casasnovas  <[email protected]>
+
+        ASSERTION FAILED: !gridWasPopulated() in WebCore::RenderGrid::placeItemsOnGrid
+        https://bugs.webkit.org/show_bug.cgi?id=136939
+
+        Reviewed by Darin Adler.
+
+        In some particular situations computeIntrinsicLogicalWidths() is called
+        in the middle of layoutGridItems(). In these cases we do not need to
+        populate the grid again, so we should avoid calling placeItemsOnGrid().
+        In addition, we do not need to clean the grid either, as that will be
+        done later by layoutGridItems().
+
+        Test: fast/css-grid-layout/grid-was-populated-assert.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Avoid calls to
+        placeItemsOnGrid() and clearGrid() if the grid was already populated.
+        * rendering/RenderGrid.h: Move gridWasPopulated() header out of the
+        debug ifdefs.
+
 2015-01-09  Zalan Bujtas  <[email protected]>
 
         Calling clearSelection on a detached RenderObject leads to segfault.

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.cpp (178496 => 178497)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.cpp	2015-01-15 09:04:38 UTC (rev 178496)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.cpp	2015-01-15 10:16:45 UTC (rev 178497)
@@ -241,7 +241,9 @@
 
 void RenderGrid::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
 {
-    const_cast<RenderGrid*>(this)->placeItemsOnGrid();
+    bool wasPopulated = gridWasPopulated();
+    if (!wasPopulated)
+        const_cast<RenderGrid*>(this)->placeItemsOnGrid();
 
     GridSizingData sizingData(gridColumnCount(), gridRowCount());
     LayoutUnit availableLogicalSpace = 0;
@@ -258,7 +260,8 @@
         // FIXME: This should add in the scrollbarWidth (e.g. see RenderFlexibleBox).
     }
 
-    const_cast<RenderGrid*>(this)->clearGrid();
+    if (!wasPopulated)
+        const_cast<RenderGrid*>(this)->clearGrid();
 }
 
 void RenderGrid::computePreferredLogicalWidths()

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.h (178496 => 178497)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.h	2015-01-15 09:04:38 UTC (rev 178496)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/rendering/RenderGrid.h	2015-01-15 10:16:45 UTC (rev 178497)
@@ -110,9 +110,10 @@
 
 #ifndef NDEBUG
     bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, const Vector<GridTrack>&);
-    bool gridWasPopulated() const { return !m_grid.isEmpty() && !m_grid[0].isEmpty(); }
 #endif
 
+    bool gridWasPopulated() const { return !m_grid.isEmpty() && !m_grid[0].isEmpty(); }
+
     size_t gridColumnCount() const
     {
         ASSERT(gridWasPopulated());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to