Title: [122003] releases/WebKitGTK/webkit-1.8
Revision
122003
Author
[email protected]
Date
2012-07-06 13:02:57 -0700 (Fri, 06 Jul 2012)

Log Message

Merge 110324 - Crash when splitting an anonymous block in multi-column layout.
https://bugs.webkit.org/show_bug.cgi?id=80432

Patch by Abhishek Arya <[email protected]> on 2012-03-09
Reviewed by David Hyatt.

Source/WebCore:

Calculating currChild->nextSibling() is risky after destroying :after content
because it can blow away currChild if it is a left over empty anonymous block.
We need to calculate next sibling upfront, using the same trick, we do in
RenderBlock::addChildIgnoringAnonymousColumnBlock to reset beforeChild (check
out the line before splitFlow call).

Test: fast/multicol/anonymous-block-split-crash.html

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

LayoutTests:

* fast/multicol/anonymous-block-split-crash-expected.txt: Added.
* fast/multicol/anonymous-block-split-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (122002 => 122003)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:02:48 UTC (rev 122002)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:02:57 UTC (rev 122003)
@@ -1,3 +1,13 @@
+2012-03-09  Abhishek Arya  <[email protected]>
+
+        Crash when splitting an anonymous block in multi-column layout.
+        https://bugs.webkit.org/show_bug.cgi?id=80432
+
+        Reviewed by David Hyatt.
+
+        * fast/multicol/anonymous-block-split-crash-expected.txt: Added.
+        * fast/multicol/anonymous-block-split-crash.html: Added.
+
 2012-03-24  Jeffrey Pfau  <[email protected]>
 
         XML error document creation should not fire mutation events

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash-expected.txt (0 => 122003)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash-expected.txt	2012-07-06 20:02:57 UTC (rev 122003)
@@ -0,0 +1 @@
+PASS
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash.html (0 => 122003)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash.html	2012-07-06 20:02:57 UTC (rev 122003)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<style>
+#test0 { -webkit-column-count: 2; }
+#test1::after { display: block; content: ''; }
+#test2:nth-last-child(2n) { content: ''; }
+#test2 { -webkit-column-span: all; }
+#test4 { float: right; }
+</style>
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+_onload_ = function() {
+    test0 = document.createElement('div');
+    test0.setAttribute('id', 'test0');
+    document.body.appendChild(test0);
+    test1 = document.createElement('div');
+    test1.setAttribute('id', 'test1');
+    test0.appendChild(test1);
+    test2 = document.createElement('div');
+    test2.setAttribute('id', 'test2');
+    test1.appendChild(test2);
+    test3 = document.createElement('span');
+    test1.appendChild(test3);
+    test3.appendChild(document.createTextNode('A'));
+    test4 = document.createElement('table');
+    test4.setAttribute('id', 'test4');
+    test1.appendChild(test4);
+    test0.style.display = 'run-in'; 
+    test4.style.display = 'table-column';
+    document.body.offsetTop;
+    document.designMode = 'on';
+    document.execCommand('selectall');
+    document.execCommand('inserttext', '');
+    document.body.offsetTop;
+    document.body.innerHTML = "PASS";
+}
+</script>
+</head>
+<body>
+</body>
+</html>
\ No newline at end of file
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/multicol/anonymous-block-split-crash.html
___________________________________________________________________

Added: svn:executable

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (122002 => 122003)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:02:48 UTC (rev 122002)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:02:57 UTC (rev 122003)
@@ -1,3 +1,21 @@
+2012-03-09  Abhishek Arya  <[email protected]>
+
+        Crash when splitting an anonymous block in multi-column layout.
+        https://bugs.webkit.org/show_bug.cgi?id=80432
+
+        Reviewed by David Hyatt.
+
+        Calculating currChild->nextSibling() is risky after destroying :after content
+        because it can blow away currChild if it is a left over empty anonymous block.
+        We need to calculate next sibling upfront, using the same trick, we do in
+        RenderBlock::addChildIgnoringAnonymousColumnBlock to reset beforeChild (check
+        out the line before splitFlow call).
+
+        Test: fast/multicol/anonymous-block-split-crash.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::splitBlocks):
+
 2012-03-24  Jeffrey Pfau  <[email protected]>
 
         XML error document creation should not fire mutation events

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderBlock.cpp (122002 => 122003)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderBlock.cpp	2012-07-06 20:02:48 UTC (rev 122002)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/rendering/RenderBlock.cpp	2012-07-06 20:02:57 UTC (rev 122003)
@@ -497,6 +497,7 @@
     // Once we hit the anonymous columns block we're done.
     RenderBoxModelObject* curr = toRenderBoxModelObject(parent());
     RenderBoxModelObject* currChild = this;
+    RenderObject* currChildNextSibling = currChild->nextSibling();
     
     while (curr && curr != fromBlock) {
         ASSERT(curr->isRenderBlock());
@@ -523,8 +524,12 @@
         // Someone may have indirectly caused a <q> to split.  When this happens, the :after content
         // has to move into the inline continuation.  Call updateBeforeAfterContent to ensure that the inline's :after
         // content gets properly destroyed.
+        bool isLastChild = (currChildNextSibling == blockCurr->lastChild());
         if (document()->usesBeforeAfterRules())
             blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER);
+        if (isLastChild && currChildNextSibling != blockCurr->lastChild())
+            currChildNextSibling = 0; // We destroyed the last child, so now we need to update
+                                      // the value of currChildNextSibling.
 
         // It is possible that positioned objects under blockCurr are going to be moved to cloneBlock.
         // Since we are doing layout anyway, it is easier to blow away the entire list, than
@@ -535,10 +540,11 @@
 
         // Now we need to take all of the children starting from the first child
         // *after* currChild and append them all to the clone.
-        blockCurr->moveChildrenTo(cloneBlock, currChild->nextSibling(), 0, true);
+        blockCurr->moveChildrenTo(cloneBlock, currChildNextSibling, 0, true);
 
         // Keep walking up the chain.
         currChild = curr;
+        currChildNextSibling = currChild->nextSibling();
         curr = toRenderBoxModelObject(curr->parent());
     }
 
@@ -547,7 +553,7 @@
 
     // Now take all the children after currChild and remove them from the fromBlock
     // and put them in the toBlock.
-    fromBlock->moveChildrenTo(toBlock, currChild->nextSibling(), 0, true);
+    fromBlock->moveChildrenTo(toBlock, currChildNextSibling, 0, true);
 }
 
 void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to