diff options
author | Ben Murdoch <benm@google.com> | 2011-01-16 13:59:45 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-01-16 14:14:41 +0000 |
commit | 8a26975f9657a07318a10d481d7f332dad759325 (patch) | |
tree | 3d4270ff2d0aa27bdbb26e83c1de9d6ac18cb4fc /WebCore/rendering/RenderBlock.cpp | |
parent | e137c43847f22807f1276afc87027711cc3f4e77 (diff) | |
download | external_webkit-8a26975f9657a07318a10d481d7f332dad759325.zip external_webkit-8a26975f9657a07318a10d481d7f332dad759325.tar.gz external_webkit-8a26975f9657a07318a10d481d7f332dad759325.tar.bz2 |
Merge WebKit at Chromium 9.0.597.69: Trivial merge by Git.
http://svn.webkit.org/repository/webkit/branches/chromium/597/WebCore@75681
Change-Id: Ibe552cf7af31f74b81e337eadf3d3b73a53daf60
Diffstat (limited to 'WebCore/rendering/RenderBlock.cpp')
-rw-r--r-- | WebCore/rendering/RenderBlock.cpp | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 8c5b994..4609f1b 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -393,10 +393,15 @@ RenderBlock* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock) RenderBlock* RenderBlock::clone() const { - RenderBlock* o = new (renderArena()) RenderBlock(node()); - o->setStyle(style()); - o->setChildrenInline(childrenInline()); - return o; + RenderBlock* cloneBlock; + if (isAnonymousBlock()) + cloneBlock = createAnonymousBlock(); + else { + cloneBlock = new (renderArena()) RenderBlock(node()); + cloneBlock->setStyle(style()); + } + cloneBlock->setChildrenInline(childrenInline()); + return cloneBlock; } void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, @@ -404,13 +409,9 @@ void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, RenderObject* beforeChild, RenderBoxModelObject* oldCont) { // Create a clone of this inline. - RenderBlock* cloneBlock; - if (isAnonymousBlock()) - cloneBlock = createAnonymousBlock(); - else { - cloneBlock = clone(); + RenderBlock* cloneBlock = clone(); + 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. @@ -435,7 +436,7 @@ void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, // Create a new clone. RenderBlock* cloneChild = cloneBlock; - cloneBlock = blockCurr->isAnonymousBlock() ? blockCurr->createAnonymousBlock() : blockCurr->clone(); + cloneBlock = blockCurr->clone(); // Insert our child clone as the first child. cloneBlock->children()->appendChildNode(cloneBlock, cloneChild); @@ -946,7 +947,7 @@ static bool canMergeContiguousAnonymousBlocks(RenderObject* oldChild, RenderObje // Make sure the types of the anonymous blocks match up. return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() - && prev->isAnonymousColumnSpanBlock() == prev->isAnonymousColumnSpanBlock(); + && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanBlock(); } void RenderBlock::removeChild(RenderObject* oldChild) @@ -980,14 +981,36 @@ void RenderBlock::removeChild(RenderObject* oldChild) blockChildrenBlock->children()->insertChildNode(blockChildrenBlock, inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChild() : 0, inlineChildrenBlock->hasLayer() || blockChildrenBlock->hasLayer()); next->setNeedsLayoutAndPrefWidthsRecalc(); + + // inlineChildrenBlock got reparented to blockChildrenBlock, so it is no longer a child + // of "this". we null out prev or next so that is not used later in the function. + if (inlineChildrenBlock == prevBlock) + prev = 0; + else + next = 0; } else { // Take all the children out of the |next| block and put them in // the |prev| block. nextBlock->moveAllChildrenTo(prevBlock, nextBlock->hasLayer() || prevBlock->hasLayer()); - + + // FIXME: When we destroy nextBlock, it might happen that nextBlock's next sibling block and + // oldChild can get merged. Since oldChild is getting removed, we do not want to move + // nextBlock's next sibling block's children into it. By setting a fake continuation, + // we prevent this from happening. + RenderBlock* oldChildBlock = 0; + if (oldChild->isAnonymous() && oldChild->isRenderBlock() && !toRenderBlock(oldChild)->continuation()) { + oldChildBlock = toRenderBlock(oldChild); + oldChildBlock->setContinuation(oldChildBlock); + } + // Delete the now-empty block's lines and nuke it. nextBlock->deleteLineBoxTree(); nextBlock->destroy(); + next = 0; + + // FIXME: Revert the continuation change done above. + if (oldChildBlock) + oldChildBlock->setContinuation(0); } } |