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

Side by Side Diff: WebCore/rendering/RenderBlock.cpp

Issue 6097012: Merge 74981 - Merge 74743 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 9 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 return currBlock; 382 return currBlock;
383 383
384 if (currBlock->isAnonymousColumnSpanBlock()) 384 if (currBlock->isAnonymousColumnSpanBlock())
385 return 0; 385 return 0;
386 } 386 }
387 return 0; 387 return 0;
388 } 388 }
389 389
390 RenderBlock* RenderBlock::clone() const 390 RenderBlock* RenderBlock::clone() const
391 { 391 {
392 RenderBlock* o = new (renderArena()) RenderBlock(node()); 392 RenderBlock* cloneBlock;
393 o->setStyle(style()); 393 if (isAnonymousBlock())
394 o->setChildrenInline(childrenInline()); 394 cloneBlock = createAnonymousBlock();
395 return o; 395 else {
396 cloneBlock = new (renderArena()) RenderBlock(node());
397 cloneBlock->setStyle(style());
398 }
399 cloneBlock->setChildrenInline(childrenInline());
400 return cloneBlock;
396 } 401 }
397 402
398 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, 403 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock,
399 RenderBlock* middleBlock, 404 RenderBlock* middleBlock,
400 RenderObject* beforeChild, RenderBoxModelObject* o ldCont) 405 RenderObject* beforeChild, RenderBoxModelObject* o ldCont)
401 { 406 {
402 // Create a clone of this inline. 407 // Create a clone of this inline.
403 RenderBlock* cloneBlock; 408 RenderBlock* cloneBlock = clone();
404 if (isAnonymousBlock()) 409 if (!isAnonymousBlock())
405 cloneBlock = createAnonymousBlock();
406 else {
407 cloneBlock = clone();
408 cloneBlock->setContinuation(oldCont); 410 cloneBlock->setContinuation(oldCont);
409 }
410 411
411 // Now take all of the children from beforeChild to the end and remove 412 // Now take all of the children from beforeChild to the end and remove
412 // them from |this| and place them in the clone. 413 // them from |this| and place them in the clone.
413 if (!beforeChild && isAfterContent(lastChild())) 414 if (!beforeChild && isAfterContent(lastChild()))
414 beforeChild = lastChild(); 415 beforeChild = lastChild();
415 moveChildrenTo(cloneBlock, beforeChild, 0); 416 moveChildrenTo(cloneBlock, beforeChild, 0);
416 417
417 // Hook |clone| up as the continuation of the middle block. 418 // Hook |clone| up as the continuation of the middle block.
418 if (!cloneBlock->isAnonymousBlock()) 419 if (!cloneBlock->isAnonymousBlock())
419 middleBlock->setContinuation(cloneBlock); 420 middleBlock->setContinuation(cloneBlock);
420 421
421 // We have been reparented and are now under the fromBlock. We need 422 // We have been reparented and are now under the fromBlock. We need
422 // to walk up our block parent chain until we hit the containing anonymous c olumns block. 423 // to walk up our block parent chain until we hit the containing anonymous c olumns block.
423 // Once we hit the anonymous columns block we're done. 424 // Once we hit the anonymous columns block we're done.
424 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); 425 RenderBoxModelObject* curr = toRenderBoxModelObject(parent());
425 RenderBoxModelObject* currChild = this; 426 RenderBoxModelObject* currChild = this;
426 427
427 while (curr && curr != fromBlock) { 428 while (curr && curr != fromBlock) {
428 ASSERT(curr->isRenderBlock()); 429 ASSERT(curr->isRenderBlock());
429 430
430 RenderBlock* blockCurr = toRenderBlock(curr); 431 RenderBlock* blockCurr = toRenderBlock(curr);
431 432
432 // Create a new clone. 433 // Create a new clone.
433 RenderBlock* cloneChild = cloneBlock; 434 RenderBlock* cloneChild = cloneBlock;
434 cloneBlock = blockCurr->isAnonymousBlock() ? blockCurr->createAnonymousB lock() : blockCurr->clone(); 435 cloneBlock = blockCurr->clone();
435 436
436 // Insert our child clone as the first child. 437 // Insert our child clone as the first child.
437 cloneBlock->children()->appendChildNode(cloneBlock, cloneChild); 438 cloneBlock->children()->appendChildNode(cloneBlock, cloneChild);
438 439
439 // Hook the clone up as a continuation of |curr|. Note we do encounter 440 // Hook the clone up as a continuation of |curr|. Note we do encounter
440 // anonymous blocks possibly as we walk up the block chain. When we spl it an 441 // anonymous blocks possibly as we walk up the block chain. When we spl it an
441 // anonymous block, there's no need to do any continuation hookup, since we haven't 442 // anonymous block, there's no need to do any continuation hookup, since we haven't
442 // actually split a real element. 443 // actually split a real element.
443 if (!blockCurr->isAnonymousBlock()) { 444 if (!blockCurr->isAnonymousBlock()) {
444 oldCont = blockCurr->continuation(); 445 oldCont = blockCurr->continuation();
(...skipping 5950 matching lines...) Expand 10 before | Expand all | Expand 10 after
6395 else if (isAnonymous()) 6396 else if (isAnonymous())
6396 return "RenderBlock (generated)"; 6397 return "RenderBlock (generated)";
6397 if (isRelPositioned()) 6398 if (isRelPositioned())
6398 return "RenderBlock (relative positioned)"; 6399 return "RenderBlock (relative positioned)";
6399 if (isRunIn()) 6400 if (isRunIn())
6400 return "RenderBlock (run-in)"; 6401 return "RenderBlock (run-in)";
6401 return "RenderBlock"; 6402 return "RenderBlock";
6402 } 6403 }
6403 6404
6404 } // namespace WebCore 6405 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/platform/mac/fast/multicol/span/clone-anonymous-block-non-inline-child-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698