Title: [107965] trunk
Revision
107965
Author
[email protected]
Date
2012-02-16 12:16:46 -0800 (Thu, 16 Feb 2012)

Log Message

Fix clone() function to handle descendant classes of RenderBlock.
https://bugs.webkit.org/show_bug.cgi?id=78273

Reviewed by Eric Seidel.

Source/WebCore:

Test: fast/multicol/span/clone-flexbox-crash.html

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

LayoutTests:

You should see two RenderFlexibleBox in the rendertree, indicating that
cloning was correct.

* fast/multicol/span/clone-flexbox-expected.txt: Added.
* fast/multicol/span/clone-flexbox.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107964 => 107965)


--- trunk/LayoutTests/ChangeLog	2012-02-16 20:14:38 UTC (rev 107964)
+++ trunk/LayoutTests/ChangeLog	2012-02-16 20:16:46 UTC (rev 107965)
@@ -1,3 +1,16 @@
+2012-02-16  Abhishek Arya  <[email protected]>
+
+        Fix clone() function to handle descendant classes of RenderBlock.
+        https://bugs.webkit.org/show_bug.cgi?id=78273
+
+        Reviewed by Eric Seidel.
+
+        You should see two RenderFlexibleBox in the rendertree, indicating that
+        cloning was correct. 
+
+        * fast/multicol/span/clone-flexbox-expected.txt: Added.
+        * fast/multicol/span/clone-flexbox.html: Added.
+
 2012-02-16  James Robinson  <[email protected]>
 
         [chromium] Unreviewed gardening

Added: trunk/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt (0 => 107965)


--- trunk/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt	2012-02-16 20:16:46 UTC (rev 107965)
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x18
+  RenderBlock {HTML} at (0,0) size 800x18
+    RenderBody {BODY} at (8,8) size 784x2
+layer at (8,8) size 784x2
+  RenderBlock {DIV} at (0,0) size 784x2
+    RenderBlock (anonymous multi-column span) at (0,1) size 784x0
+      RenderBlock {DIV} at (0,0) size 784x0
+layer at (8,8) size 784x1
+  RenderBlock (anonymous multi-column) at (0,0) size 784x1
+    RenderFlexibleBox {OL} at (0,1) size 40x0
+layer at (8,9) size 784x1
+  RenderBlock (anonymous multi-column) at (0,1) size 784x1
+    RenderFlexibleBox {OL} at (0,1) size 40x0

Added: trunk/LayoutTests/fast/multicol/span/clone-flexbox.html (0 => 107965)


--- trunk/LayoutTests/fast/multicol/span/clone-flexbox.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/span/clone-flexbox.html	2012-02-16 20:16:46 UTC (rev 107965)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<body>
+<style>
+#container { -webkit-column-width: 1px; }
+#div1 { -webkit-column-span: all; }
+</style>
+<script>
+document.body.offsetTop;
+var container = document.createElement('div');
+container.setAttribute('id', 'container');
+document.body.appendChild(container); 
+flexbox1 = document.createElement('ol');
+flexbox1.setAttribute('id', 'flexbox1');
+container.appendChild(flexbox1);
+var div1 = document.createElement('div');
+div1.setAttribute('id', 'div1');
+flexbox1.appendChild(div1);
+flexbox1.style.display = '-webkit-flexbox';
+</script>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/multicol/span/clone-flexbox.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (107964 => 107965)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 20:14:38 UTC (rev 107964)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 20:16:46 UTC (rev 107965)
@@ -1,3 +1,15 @@
+2012-02-16  Abhishek Arya  <[email protected]>
+
+        Fix clone() function to handle descendant classes of RenderBlock.
+        https://bugs.webkit.org/show_bug.cgi?id=78273
+
+        Reviewed by Eric Seidel.
+
+        Test: fast/multicol/span/clone-flexbox-crash.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::clone):
+
 2012-02-16  Raul Hudea  <[email protected]>
 
         [CSSRegions]overflowRegion tests are flaky

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (107964 => 107965)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-02-16 20:14:38 UTC (rev 107964)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-02-16 20:16:46 UTC (rev 107965)
@@ -451,19 +451,13 @@
 RenderBlock* RenderBlock::clone() const
 {
     RenderBlock* cloneBlock;
-    if (isAnonymousBlock()) {
-        cloneBlock = createAnonymousBlock();
-        cloneBlock->setChildrenInline(childrenInline());
-    }
-    else {
-        cloneBlock = new (renderArena()) RenderBlock(node());
-        cloneBlock->setStyle(style());
+    cloneBlock = toRenderBlock(RenderObject::createObject(isAnonymous() ? document() : node(), style()));
+    cloneBlock->setStyle(style());
 
-        // This takes care of setting the right value of childrenInline in case
-        // generated content is added to cloneBlock and 'this' does not have
-        // generated content added yet.
-        cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->firstChild()->isInline() : childrenInline());
-    }
+    // This takes care of setting the right value of childrenInline in case
+    // generated content is added to cloneBlock and 'this' does not have
+    // generated content added yet.
+    cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->firstChild()->isInline() : childrenInline());
     return cloneBlock;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to