Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2604)

Unified Diff: WebCore/rendering/RenderBlock.cpp

Issue 5643001: Merge 73296 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/platform/mac/fast/multicol/span/anonymous-split-block-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/rendering/RenderBlock.cpp
===================================================================
--- WebCore/rendering/RenderBlock.cpp (revision 73302)
+++ WebCore/rendering/RenderBlock.cpp (working copy)
@@ -400,8 +400,13 @@
RenderObject* beforeChild, RenderBoxModelObject* oldCont)
{
// Create a clone of this inline.
- RenderBlock* cloneBlock = clone();
- cloneBlock->setContinuation(oldCont);
+ RenderBlock* cloneBlock;
+ if (isAnonymousBlock())
+ cloneBlock = createAnonymousBlock();
+ else {
+ cloneBlock = clone();
+ 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.
@@ -410,7 +415,8 @@
moveChildrenTo(cloneBlock, beforeChild, 0);
// Hook |clone| up as the continuation of the middle block.
- middleBlock->setContinuation(cloneBlock);
+ if (!cloneBlock->isAnonymousBlock())
+ middleBlock->setContinuation(cloneBlock);
// We have been reparented and are now under the fromBlock. We need
// to walk up our block parent chain until we hit the containing anonymous columns block.
@@ -419,13 +425,13 @@
RenderBoxModelObject* currChild = this;
while (curr && curr != fromBlock) {
- ASSERT(curr->isRenderBlock() && !curr->isAnonymousBlock());
+ ASSERT(curr->isRenderBlock());
RenderBlock* blockCurr = toRenderBlock(curr);
// Create a new clone.
RenderBlock* cloneChild = cloneBlock;
- cloneBlock = blockCurr->clone();
+ cloneBlock = blockCurr->isAnonymousBlock() ? blockCurr->createAnonymousBlock() : blockCurr->clone();
// Insert our child clone as the first child.
cloneBlock->children()->appendChildNode(cloneBlock, cloneChild);
@@ -623,6 +629,41 @@
beforeChild = lastRenderer->lastChild();
}
+ // If the requested beforeChild is not one of our children, then this is because
+ // there is an anonymous container within this object that contains the beforeChild.
+ if (beforeChild && beforeChild->parent() != this) {
+ RenderObject* anonymousChild = beforeChild->parent();
+ ASSERT(anonymousChild);
+
+ while (anonymousChild->parent() != this)
+ anonymousChild = anonymousChild->parent();
+
+ ASSERT(anonymousChild->isAnonymous());
+
+ if (anonymousChild->isAnonymousBlock()) {
+ // Insert the child into the anonymous block box instead of here.
+ if (newChild->isInline() || beforeChild->parent()->firstChild() != beforeChild)
+ beforeChild->parent()->addChild(newChild, beforeChild);
+ else
+ addChild(newChild, beforeChild->parent());
+ return;
+ }
+
+ ASSERT(anonymousChild->isTable());
+ if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
+ || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
+ || newChild->isTableSection()
+ || newChild->isTableRow()
+ || newChild->isTableCell()) {
+ // Insert into the anonymous table.
+ anonymousChild->addChild(newChild, beforeChild);
+ return;
+ }
+
+ // Go on to insert before the anonymous table.
+ beforeChild = anonymousChild;
+ }
+
// Check for a spanning element in columns.
RenderBlock* columnsBlockAncestor = columnsBlockForSpanningElement(newChild);
if (columnsBlockAncestor) {
@@ -658,41 +699,6 @@
bool madeBoxesNonInline = false;
- // If the requested beforeChild is not one of our children, then this is because
- // there is an anonymous container within this object that contains the beforeChild.
- if (beforeChild && beforeChild->parent() != this) {
- RenderObject* anonymousChild = beforeChild->parent();
- ASSERT(anonymousChild);
-
- while (anonymousChild->parent() != this)
- anonymousChild = anonymousChild->parent();
-
- ASSERT(anonymousChild->isAnonymous());
-
- if (anonymousChild->isAnonymousBlock()) {
- // Insert the child into the anonymous block box instead of here.
- if (newChild->isInline() || beforeChild->parent()->firstChild() != beforeChild)
- beforeChild->parent()->addChild(newChild, beforeChild);
- else
- addChild(newChild, beforeChild->parent());
- return;
- }
-
- ASSERT(anonymousChild->isTable());
- if ((newChild->isTableCol() && newChild->style()->display() == TABLE_COLUMN_GROUP)
- || (newChild->isRenderBlock() && newChild->style()->display() == TABLE_CAPTION)
- || newChild->isTableSection()
- || newChild->isTableRow()
- || newChild->isTableCell()) {
- // Insert into the anonymous table.
- anonymousChild->addChild(newChild, beforeChild);
- return;
- }
-
- // Go on to insert before the anonymous table.
- beforeChild = anonymousChild;
- }
-
// A block has to either have all of its children inline, or all of its children as blocks.
// So, if our children are currently inline and a block child has to be inserted, we move all our
// inline children into anonymous block boxes.
« no previous file with comments | « LayoutTests/platform/mac/fast/multicol/span/anonymous-split-block-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698