Title: [124564] trunk
Revision
124564
Author
[email protected]
Date
2012-08-02 22:53:38 -0700 (Thu, 02 Aug 2012)

Log Message

Crash due to layer not removed from parent for anonymous block.
https://bugs.webkit.org/show_bug.cgi?id=90800

Reviewed by Kent Tamura.

Source/WebCore:

Reverse the order of setStyle and removeChildNode calls. This ensures that setting the style
properly removes its layer from the parent in RenderBoxModelObject::styleDidChange. Calling
removeChildNode before calling setStyle is problematic since the parent layer never gets
notified.

Test: fast/block/layer-not-removed-from-parent-crash.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeChild):

LayoutTests:

* fast/block/layer-not-removed-from-parent-crash-expected.txt: Added.
* fast/block/layer-not-removed-from-parent-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (124563 => 124564)


--- trunk/LayoutTests/ChangeLog	2012-08-03 05:32:32 UTC (rev 124563)
+++ trunk/LayoutTests/ChangeLog	2012-08-03 05:53:38 UTC (rev 124564)
@@ -1,3 +1,13 @@
+2012-08-02  Abhishek Arya  <[email protected]>
+
+        Crash due to layer not removed from parent for anonymous block.
+        https://bugs.webkit.org/show_bug.cgi?id=90800
+
+        Reviewed by Kent Tamura.
+
+        * fast/block/layer-not-removed-from-parent-crash-expected.txt: Added.
+        * fast/block/layer-not-removed-from-parent-crash.html: Added.
+
 2012-08-02  Filip Pizlo  <[email protected]>
 
         Unreviewed, land some overrides for Chromium for the tests I just added, since

Added: trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash-expected.txt (0 => 124564)


--- trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash-expected.txt	2012-08-03 05:53:38 UTC (rev 124564)
@@ -0,0 +1 @@
+PASS. WebKit didn't crash.

Added: trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash.html (0 => 124564)


--- trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash.html	2012-08-03 05:53:38 UTC (rev 124564)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<body style='-webkit-columns: 1'>
+A
+<style>
+.class1 { -webkit-column-span: all; }
+</style><script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+function crash() {
+test1 = document.createElementNS("http://www.w3.org/1999/xhtml", "article");
+document.body.appendChild(test1);
+test1.appendChild(document.createTextNode('A'));
+test1.setAttribute("class", "class1");
+test2 = document.createElementNS("http://www.w3.org/1999/xhtml", "article");
+document.body.appendChild(test2);
+test2.appendChild(document.createTextNode('A'));
+test2.setAttribute("class", "class1");
+document.body.offsetTop;
+document.designMode = "on";
+document.execCommand("InsertHTML", false, "No crash!")
+document.execCommand("SelectAll", false)
+document.execCommand("InsertHTML", false, "There should be an empty line between these two paragraphs.<span><div></div></span><div>This paragraph and the empty line should have be in their own divs with a red border.")
+document.execCommand("SelectAll", false)
+document.execCommand("InsertHTML", false, "There should be an empty line between these two paragraphs.<span><div></div></span><div>This paragraph and the empty line should have be in their own divs with a red border.")
+document.body.offsetTop;
+document.body.innerHTML = "PASS. WebKit didn't crash.";
+}
+document.addEventListener("DOMContentLoaded", crash, false);
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/block/layer-not-removed-from-parent-crash.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (124563 => 124564)


--- trunk/Source/WebCore/ChangeLog	2012-08-03 05:32:32 UTC (rev 124563)
+++ trunk/Source/WebCore/ChangeLog	2012-08-03 05:53:38 UTC (rev 124564)
@@ -1,3 +1,20 @@
+2012-08-02  Abhishek Arya  <[email protected]>
+
+        Crash due to layer not removed from parent for anonymous block.
+        https://bugs.webkit.org/show_bug.cgi?id=90800
+
+        Reviewed by Kent Tamura.
+
+        Reverse the order of setStyle and removeChildNode calls. This ensures that setting the style
+        properly removes its layer from the parent in RenderBoxModelObject::styleDidChange. Calling
+        removeChildNode before calling setStyle is problematic since the parent layer never gets
+        notified.
+
+        Test: fast/block/layer-not-removed-from-parent-crash.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::removeChild):
+
 2012-08-02  Adam Barth  <[email protected]>
 
         V8Proxy::retrieveFrameFor*Context are used only by BindingState and should be removed as separate functions

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (124563 => 124564)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-08-03 05:32:32 UTC (rev 124563)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-08-03 05:53:38 UTC (rev 124564)
@@ -1169,8 +1169,8 @@
             // column span flag if it is set.
             ASSERT(!inlineChildrenBlock->continuation());
             RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK);
+            inlineChildrenBlock->setStyle(newStyle);
             children()->removeChildNode(this, inlineChildrenBlock, inlineChildrenBlock->hasLayer());
-            inlineChildrenBlock->setStyle(newStyle);
             
             // Now just put the inlineChildrenBlock inside the blockChildrenBlock.
             blockChildrenBlock->children()->insertChildNode(blockChildrenBlock, inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChild() : 0,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to