Title: [183913] trunk
Revision
183913
Author
r...@igalia.com
Date
2015-05-06 23:07:25 -0700 (Wed, 06 May 2015)

Log Message

[CSS Grid Layout] Mark grid shorthands as layout dependent
https://bugs.webkit.org/show_bug.cgi?id=144687

Reviewed by Darin Adler.

Source/WebCore:

grid-template and grid shorthands were not marked us layout dependent,
so you can end up calling them before the grid has been laid out and
you'll get a crash at valueForGridTrackList() because of trackPositions
won't be initialized yet.

Tests: fast/css-grid-layout/grid-shorthand-computed-style-crash.html
       fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::isLayoutDependent): Add the grid shorthands only if the object
is a RenderGrid as otherwise it's not needed (using the same condition
for grid-template-columns and grid-template-rows properties too).

LayoutTests:

* fast/css-grid-layout/grid-shorthand-computed-style-crash-expected.txt: Added.
* fast/css-grid-layout/grid-shorthand-computed-style-crash.html: Added.
* fast/css-grid-layout/grid-template-shorthand-computed-style-crash-expected.txt: Added.
* fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (183912 => 183913)


--- trunk/LayoutTests/ChangeLog	2015-05-07 05:15:56 UTC (rev 183912)
+++ trunk/LayoutTests/ChangeLog	2015-05-07 06:07:25 UTC (rev 183913)
@@ -1,3 +1,15 @@
+2015-05-06  Manuel Rego Casasnovas  <r...@igalia.com>
+
+        [CSS Grid Layout] Mark grid shorthands as layout dependent
+        https://bugs.webkit.org/show_bug.cgi?id=144687
+
+        Reviewed by Darin Adler.
+
+        * fast/css-grid-layout/grid-shorthand-computed-style-crash-expected.txt: Added.
+        * fast/css-grid-layout/grid-shorthand-computed-style-crash.html: Added.
+        * fast/css-grid-layout/grid-template-shorthand-computed-style-crash-expected.txt: Added.
+        * fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html: Added.
+
 2015-05-06  Ryosuke Niwa  <rn...@webkit.org>
 
         ToT WebKit crashes while loading ES6 compatibility table

Added: trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash-expected.txt (0 => 183913)


--- trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash-expected.txt	2015-05-07 06:07:25 UTC (rev 183913)
@@ -0,0 +1,3 @@
+This test checks that getting computed style of grid shorthand does not crash.
+
+

Added: trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash.html (0 => 183913)


--- trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-shorthand-computed-style-crash.html	2015-05-07 06:07:25 UTC (rev 183913)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+    .grid {
+        -webkit-grid: 100px / 50px;
+    }
+</style>
+<p>This test checks that getting computed style of grid shorthand does not crash.</p>
+<div id="grid" class="grid">
+</div>
+<script>
+    var grid = document.getElementById("grid");
+    getComputedStyle(grid).webkitGrid;
+</script>

Added: trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash-expected.txt (0 => 183913)


--- trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash-expected.txt	2015-05-07 06:07:25 UTC (rev 183913)
@@ -0,0 +1,3 @@
+This test checks that getting computed style of grid-template shorthand does not crash.
+
+

Added: trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html (0 => 183913)


--- trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html	2015-05-07 06:07:25 UTC (rev 183913)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<link href="" rel="stylesheet">
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+    .grid {
+        -webkit-grid-template: 100px / 50px;
+    }
+</style>
+<p>This test checks that getting computed style of grid-template shorthand does not crash.</p>
+<div id="grid" class="grid">
+</div>
+<script>
+    var grid = document.getElementById("grid");
+    getComputedStyle(grid).webkitGridTemplate;
+</script>

Modified: trunk/Source/WebCore/ChangeLog (183912 => 183913)


--- trunk/Source/WebCore/ChangeLog	2015-05-07 05:15:56 UTC (rev 183912)
+++ trunk/Source/WebCore/ChangeLog	2015-05-07 06:07:25 UTC (rev 183913)
@@ -1,3 +1,23 @@
+2015-05-06  Manuel Rego Casasnovas  <r...@igalia.com>
+
+        [CSS Grid Layout] Mark grid shorthands as layout dependent
+        https://bugs.webkit.org/show_bug.cgi?id=144687
+
+        Reviewed by Darin Adler.
+
+        grid-template and grid shorthands were not marked us layout dependent,
+        so you can end up calling them before the grid has been laid out and
+        you'll get a crash at valueForGridTrackList() because of trackPositions
+        won't be initialized yet.
+
+        Tests: fast/css-grid-layout/grid-shorthand-computed-style-crash.html
+               fast/css-grid-layout/grid-template-shorthand-computed-style-crash.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::isLayoutDependent): Add the grid shorthands only if the object
+        is a RenderGrid as otherwise it's not needed (using the same condition
+        for grid-template-columns and grid-template-rows properties too).
+
 2015-05-06  Daniel Bates  <daba...@apple.com>
 
         [iOS][WK2] Pause/resume database thread when UIProcess enters/leaves the background

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (183912 => 183913)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-05-07 05:15:56 UTC (rev 183912)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-05-07 06:07:25 UTC (rev 183913)
@@ -1652,10 +1652,6 @@
     switch (propertyID) {
     case CSSPropertyWidth:
     case CSSPropertyHeight:
-#if ENABLE(CSS_GRID_LAYOUT)
-    case CSSPropertyWebkitGridTemplateColumns:
-    case CSSPropertyWebkitGridTemplateRows:
-#endif
     case CSSPropertyPerspectiveOrigin:
     case CSSPropertyTransformOrigin:
     case CSSPropertyTransform:
@@ -1692,6 +1688,13 @@
         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingBottom>(style, renderer);
     case CSSPropertyPaddingLeft:
         return paddingOrMarginIsRendererDependent<&RenderStyle::paddingLeft>(style, renderer); 
+#if ENABLE(CSS_GRID_LAYOUT)
+    case CSSPropertyWebkitGridTemplateColumns:
+    case CSSPropertyWebkitGridTemplateRows:
+    case CSSPropertyWebkitGridTemplate:
+    case CSSPropertyWebkitGrid:
+        return renderer && renderer->isRenderGrid();
+#endif
     default:
         return false;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to