From 84396bd10413153b07945af16f7f80d8b6070bc1 Mon Sep 17 00:00:00 2001 From: "inferno@chromium.org" Date: Wed, 22 Feb 2012 21:07:18 +0000 Subject: [PATCH] Cloning and linebox issues in multi-column layout. https://bugs.webkit.org/show_bug.cgi?id=78273 Reviewed by Eric Seidel. Source/WebCore: Tests: fast/multicol/span/clone-flexbox.html fast/multicol/span/clone-summary.html fast/multicol/span/textbox-not-removed-crash.html * rendering/RenderBlock.cpp: (WebCore::RenderBlock::clone): Fix cloning algorithm to take care of cloning descendant classes of RenderBlock. (WebCore::RenderBlock::splitBlocks): When we move our inline children to cloneBlock, we need to clear our entire line box tree. Any descendant child in the hierarchy could be a part of our line box tree and will never get cleared since the child has moved to new parent cloneBlock. LayoutTests: * fast/multicol/span/clone-flexbox-expected.png: * fast/multicol/span/clone-flexbox-expected.txt: Added. * fast/multicol/span/clone-flexbox.html: Added. Test passes if we see two RenderFlexibox in the rendertree. * fast/multicol/span/clone-summary-expected.png: Added. * fast/multicol/span/clone-summary-expected.txt: Added. * fast/multicol/span/clone-summary.html: Added. Test passes if we see two RenderSummary in the rendertree. * fast/multicol/span/textbox-not-removed-crash-expected.txt: Added. * fast/multicol/span/textbox-not-removed-crash.html: Added. Test passes it we do not crash on m_hasBadParent assert in InlineBox. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108543 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 19 ++++++++++ .../fast/multicol/span/clone-flexbox-expected.txt | 21 +++++++++++ LayoutTests/fast/multicol/span/clone-flexbox.html | 25 +++++++++++++ .../fast/multicol/span/clone-summary-expected.png | Bin 0 -> 9754 bytes .../fast/multicol/span/clone-summary-expected.txt | 19 ++++++++++ LayoutTests/fast/multicol/span/clone-summary.html | 25 +++++++++++++ .../span/textbox-not-removed-crash-expected.txt | 2 ++ .../multicol/span/textbox-not-removed-crash.html | 40 +++++++++++++++++++++ Source/WebCore/ChangeLog | 19 ++++++++++ Source/WebCore/rendering/RenderBlock.cpp | 13 +++++-- 10 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 LayoutTests/fast/multicol/span/clone-flexbox-expected.txt create mode 100755 LayoutTests/fast/multicol/span/clone-flexbox.html create mode 100644 LayoutTests/fast/multicol/span/clone-summary-expected.png create mode 100644 LayoutTests/fast/multicol/span/clone-summary-expected.txt create mode 100755 LayoutTests/fast/multicol/span/clone-summary.html create mode 100644 LayoutTests/fast/multicol/span/textbox-not-removed-crash-expected.txt create mode 100755 LayoutTests/fast/multicol/span/textbox-not-removed-crash.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 478edda..72f795a 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,22 @@ +2012-02-22 Abhishek Arya + + Cloning and linebox issues in multi-column layout. + https://bugs.webkit.org/show_bug.cgi?id=78273 + + Reviewed by Eric Seidel. + + * fast/multicol/span/clone-flexbox-expected.png: + * fast/multicol/span/clone-flexbox-expected.txt: Added. + * fast/multicol/span/clone-flexbox.html: Added. Test passes if we + see two RenderFlexibox in the rendertree. + * fast/multicol/span/clone-summary-expected.png: Added. + * fast/multicol/span/clone-summary-expected.txt: Added. + * fast/multicol/span/clone-summary.html: Added. Test passes if we + see two RenderSummary in the rendertree. + * fast/multicol/span/textbox-not-removed-crash-expected.txt: Added. + * fast/multicol/span/textbox-not-removed-crash.html: Added. Test + passes it we do not crash on m_hasBadParent assert in InlineBox. + 2012-02-22 Adrienne Walker [chromium] Unreviewed gardening. Rebaseline svg expectations after r108493. diff --git a/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt b/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt new file mode 100644 index 0000000..a8486e3 --- /dev/null +++ b/LayoutTests/fast/multicol/span/clone-flexbox-expected.txt @@ -0,0 +1,21 @@ +layer at (0,0) size 800x600 + RenderView at (0,0) size 800x600 +layer at (0,0) size 800x48 + RenderBlock {HTML} at (0,0) size 800x48 + RenderBody {BODY} at (8,8) size 784x32 +layer at (8,8) size 784x32 + RenderBlock {DIV} at (0,0) size 784x32 + RenderBlock (anonymous multi-column span) at (0,16) size 784x0 [color=#FFFFFF] + RenderBlock {DIV} at (0,0) size 784x0 +layer at (8,8) size 784x16 + RenderBlock (anonymous multi-column) at (0,0) size 784x16 + RenderFlexibleBox {DIV} at (0,0) size 117x16 [color=#FFFFFF] + RenderBlock (anonymous) at (0,0) size 16x16 + RenderText {#text} at (0,0) size 16x16 + text run at (0,0) width 16: "a" +layer at (8,24) size 784x16 + RenderBlock (anonymous multi-column) at (0,16) size 784x16 + RenderFlexibleBox {DIV} at (0,0) size 117x16 [color=#FFFFFF] + RenderBlock (anonymous) at (0,0) size 16x16 + RenderText {#text} at (0,0) size 16x16 + text run at (0,0) width 16: "b" diff --git a/LayoutTests/fast/multicol/span/clone-flexbox.html b/LayoutTests/fast/multicol/span/clone-flexbox.html new file mode 100755 index 0000000..61b55a0 --- /dev/null +++ b/LayoutTests/fast/multicol/span/clone-flexbox.html @@ -0,0 +1,25 @@ + + + + + + + diff --git a/LayoutTests/fast/multicol/span/clone-summary-expected.png b/LayoutTests/fast/multicol/span/clone-summary-expected.png new file mode 100644 index 0000000000000000000000000000000000000000..a32edcf86bb8738039fb9a982a8e42c73392157a GIT binary patch literal 9754 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i1B%QlYbpRznkB9gCCM47$=SuFxeOMj z#wn==2Bv1_DTYRdNvVkjN#;qZ$*E>$iKZ!LhRF%$|9>+uC@^@sIEGX(zP-MYmqCGt z#W3OjT;`;X)pJpMGpcU$9{W#h_7;PVowhu?!hokMo z(e@#*k2%^t9&I0wwvR{K$D{3I@PONB|6sI#Fxo#D?H`Qx4@Ub3qy2-?{=sPfXmoyY zbbfVoewo_y>lf$C=`b*`E�s7;S5ewlzlE8l!EE(YD55Yil%ezYOPClYVA`1aPqz NgQu&X%Q~loCIA}kY=8g& literal 0 HcmV?d00001 diff --git a/LayoutTests/fast/multicol/span/clone-summary-expected.txt b/LayoutTests/fast/multicol/span/clone-summary-expected.txt new file mode 100644 index 0000000..2cc8f91 --- /dev/null +++ b/LayoutTests/fast/multicol/span/clone-summary-expected.txt @@ -0,0 +1,19 @@ +layer at (0,0) size 800x600 + RenderView at (0,0) size 800x600 +layer at (0,0) size 800x48 + RenderBlock {HTML} at (0,0) size 800x48 + RenderBody {BODY} at (8,8) size 784x32 +layer at (8,8) size 784x32 + RenderBlock {DIV} at (0,0) size 784x32 + RenderBlock (anonymous multi-column span) at (0,16) size 784x0 [color=#FFFFFF] + RenderBlock {DIV} at (0,0) size 784x0 +layer at (8,8) size 784x16 + RenderBlock (anonymous multi-column) at (0,0) size 784x16 + RenderSummary {SUMMARY} at (0,0) size 117x16 [color=#FFFFFF] + RenderText {#text} at (0,0) size 16x16 + text run at (0,0) width 16: "a" +layer at (8,24) size 784x16 + RenderBlock (anonymous multi-column) at (0,16) size 784x16 + RenderSummary {SUMMARY} at (0,0) size 117x16 [color=#FFFFFF] + RenderText {#text} at (0,0) size 16x16 + text run at (0,0) width 16: "b" diff --git a/LayoutTests/fast/multicol/span/clone-summary.html b/LayoutTests/fast/multicol/span/clone-summary.html new file mode 100755 index 0000000..fc7c212 --- /dev/null +++ b/LayoutTests/fast/multicol/span/clone-summary.html @@ -0,0 +1,25 @@ + + + + + + + diff --git a/LayoutTests/fast/multicol/span/textbox-not-removed-crash-expected.txt b/LayoutTests/fast/multicol/span/textbox-not-removed-crash-expected.txt new file mode 100644 index 0000000..c5fd503 --- /dev/null +++ b/LayoutTests/fast/multicol/span/textbox-not-removed-crash-expected.txt @@ -0,0 +1,2 @@ +Test passes if it does not crash. +A diff --git a/LayoutTests/fast/multicol/span/textbox-not-removed-crash.html b/LayoutTests/fast/multicol/span/textbox-not-removed-crash.html new file mode 100755 index 0000000..c06ca00 --- /dev/null +++ b/LayoutTests/fast/multicol/span/textbox-not-removed-crash.html @@ -0,0 +1,40 @@ + + + + + + + +Test passes if it does not crash. + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 3d60f48..e56934a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2012-02-22 Abhishek Arya + + Cloning and linebox issues in multi-column layout. + https://bugs.webkit.org/show_bug.cgi?id=78273 + + Reviewed by Eric Seidel. + + Tests: fast/multicol/span/clone-flexbox.html + fast/multicol/span/clone-summary.html + fast/multicol/span/textbox-not-removed-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::clone): Fix cloning algorithm to take + care of cloning descendant classes of RenderBlock. + (WebCore::RenderBlock::splitBlocks): When we move our inline children + to cloneBlock, we need to clear our entire line box tree. Any descendant + child in the hierarchy could be a part of our line box tree and will + never get cleared since the child has moved to new parent cloneBlock. + 2012-02-22 Tim Dresser CCLayerTreeHostImpl calls didDraw more frequently than willDraw diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 9308877..c5e94c1 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -462,7 +462,8 @@ RenderBlock* RenderBlock::clone() const cloneBlock->setChildrenInline(childrenInline()); } else { - cloneBlock = new (renderArena()) RenderBlock(node()); + RenderObject* cloneRenderer = node()->createRenderer(renderArena(), style()); + cloneBlock = toRenderBlock(cloneRenderer); cloneBlock->setStyle(style()); // This takes care of setting the right value of childrenInline in case @@ -482,10 +483,16 @@ void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, if (!isAnonymousBlock()) cloneBlock->setContinuation(oldCont); - // Now take all of the children from beforeChild to the end and remove - // them from |this| and place them in the clone. if (!beforeChild && isAfterContent(lastChild())) beforeChild = lastChild(); + + // If we are moving inline children from |this| to cloneBlock, then we need + // to clear our line box tree. + if (beforeChild && childrenInline()) + deleteLineBoxTree(); + + // Now take all of the children from beforeChild to the end and remove + // them from |this| and place them in the clone. moveChildrenTo(cloneBlock, beforeChild, 0, true); // Hook |clone| up as the continuation of the middle block. -- 2.7.4