OLD | NEW |
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, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 434 |
435 if (currBlock->isAnonymousColumnSpanBlock()) | 435 if (currBlock->isAnonymousColumnSpanBlock()) |
436 return 0; | 436 return 0; |
437 } | 437 } |
438 return 0; | 438 return 0; |
439 } | 439 } |
440 | 440 |
441 RenderBlock* RenderBlock::clone() const | 441 RenderBlock* RenderBlock::clone() const |
442 { | 442 { |
443 RenderBlock* cloneBlock; | 443 RenderBlock* cloneBlock; |
444 if (isAnonymousBlock()) | 444 if (isAnonymousBlock()) { |
445 cloneBlock = createAnonymousBlock(); | 445 cloneBlock = createAnonymousBlock(); |
| 446 cloneBlock->setChildrenInline(childrenInline()); |
| 447 } |
446 else { | 448 else { |
447 cloneBlock = new (renderArena()) RenderBlock(node()); | 449 cloneBlock = new (renderArena()) RenderBlock(node()); |
448 cloneBlock->setStyle(style()); | 450 cloneBlock->setStyle(style()); |
449 if (!childrenInline() && cloneBlock->firstChild() && cloneBlock->firstCh
ild()->isInline()) | 451 |
450 cloneBlock->makeChildrenNonInline(); | 452 // This takes care of setting the right value of childrenInline in case |
| 453 // generated content is added to cloneBlock and 'this' does not have |
| 454 // generated content added yet. |
| 455 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); |
451 } | 456 } |
452 cloneBlock->setChildrenInline(childrenInline()); | |
453 return cloneBlock; | 457 return cloneBlock; |
454 } | 458 } |
455 | 459 |
456 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, | 460 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, |
457 RenderBlock* middleBlock, | 461 RenderBlock* middleBlock, |
458 RenderObject* beforeChild, RenderBoxModelObject* o
ldCont) | 462 RenderObject* beforeChild, RenderBoxModelObject* o
ldCont) |
459 { | 463 { |
460 // Create a clone of this inline. | 464 // Create a clone of this inline. |
461 RenderBlock* cloneBlock = clone(); | 465 RenderBlock* cloneBlock = clone(); |
462 if (!isAnonymousBlock()) | 466 if (!isAnonymousBlock()) |
(...skipping 18 matching lines...) Expand all Loading... |
481 while (curr && curr != fromBlock) { | 485 while (curr && curr != fromBlock) { |
482 ASSERT(curr->isRenderBlock()); | 486 ASSERT(curr->isRenderBlock()); |
483 | 487 |
484 RenderBlock* blockCurr = toRenderBlock(curr); | 488 RenderBlock* blockCurr = toRenderBlock(curr); |
485 | 489 |
486 // Create a new clone. | 490 // Create a new clone. |
487 RenderBlock* cloneChild = cloneBlock; | 491 RenderBlock* cloneChild = cloneBlock; |
488 cloneBlock = blockCurr->clone(); | 492 cloneBlock = blockCurr->clone(); |
489 | 493 |
490 // Insert our child clone as the first child. | 494 // Insert our child clone as the first child. |
491 cloneBlock->children()->appendChildNode(cloneBlock, cloneChild); | 495 cloneBlock->addChildIgnoringContinuation(cloneChild, 0); |
492 | 496 |
493 // Hook the clone up as a continuation of |curr|. Note we do encounter | 497 // Hook the clone up as a continuation of |curr|. Note we do encounter |
494 // anonymous blocks possibly as we walk up the block chain. When we spl
it an | 498 // anonymous blocks possibly as we walk up the block chain. When we spl
it an |
495 // anonymous block, there's no need to do any continuation hookup, since
we haven't | 499 // anonymous block, there's no need to do any continuation hookup, since
we haven't |
496 // actually split a real element. | 500 // actually split a real element. |
497 if (!blockCurr->isAnonymousBlock()) { | 501 if (!blockCurr->isAnonymousBlock()) { |
498 oldCont = blockCurr->continuation(); | 502 oldCont = blockCurr->continuation(); |
499 blockCurr->setContinuation(cloneBlock); | 503 blockCurr->setContinuation(cloneBlock); |
500 cloneBlock->setContinuation(oldCont); | 504 cloneBlock->setContinuation(oldCont); |
501 } | 505 } |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 return new (renderArena()) RootInlineBox(this); | 876 return new (renderArena()) RootInlineBox(this); |
873 } | 877 } |
874 | 878 |
875 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() | 879 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() |
876 { | 880 { |
877 RootInlineBox* rootBox = createRootInlineBox(); | 881 RootInlineBox* rootBox = createRootInlineBox(); |
878 m_lineBoxes.appendLineBox(rootBox); | 882 m_lineBoxes.appendLineBox(rootBox); |
879 return rootBox; | 883 return rootBox; |
880 } | 884 } |
881 | 885 |
882 void RenderBlock::moveChildTo(RenderBlock* to, RenderObject* child, RenderObject
* beforeChild, bool fullRemoveInsert) | 886 void RenderBlock::moveChildTo(RenderBlock* toBlock, RenderObject* child, RenderO
bject* beforeChild, bool fullRemoveInsert) |
883 { | 887 { |
884 ASSERT(this == child->parent()); | 888 ASSERT(this == child->parent()); |
885 ASSERT(!beforeChild || to == beforeChild->parent()); | 889 ASSERT(!beforeChild || toBlock == beforeChild->parent()); |
886 to->children()->insertChildNode(to, children()->removeChildNode(this, child,
fullRemoveInsert), beforeChild, fullRemoveInsert); | 890 if (fullRemoveInsert) { |
| 891 // Takes care of adding the new child correctly if toBlock and fromBlock |
| 892 // have different kind of children (block vs inline). |
| 893 toBlock->addChildIgnoringContinuation(children()->removeChildNode(this,
child), beforeChild); |
| 894 } else |
| 895 toBlock->children()->insertChildNode(toBlock, children()->removeChildNod
e(this, child, false), beforeChild, false); |
887 } | 896 } |
888 | 897 |
889 void RenderBlock::moveChildrenTo(RenderBlock* to, RenderObject* startChild, Rend
erObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert) | 898 void RenderBlock::moveChildrenTo(RenderBlock* toBlock, RenderObject* startChild,
RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert) |
890 { | 899 { |
891 ASSERT(!beforeChild || to == beforeChild->parent()); | 900 ASSERT(!beforeChild || toBlock == beforeChild->parent()); |
892 RenderObject* nextChild = startChild; | 901 RenderObject* nextChild = startChild; |
893 while (nextChild && nextChild != endChild) { | 902 while (nextChild && nextChild != endChild) { |
894 RenderObject* child = nextChild; | 903 RenderObject* child = nextChild; |
895 nextChild = child->nextSibling(); | 904 nextChild = child->nextSibling(); |
896 to->children()->insertChildNode(to, children()->removeChildNode(this, ch
ild, fullRemoveInsert), beforeChild, fullRemoveInsert); | 905 if (fullRemoveInsert) { |
| 906 // Takes care of adding the new child correctly if toBlock and fromB
lock |
| 907 // have different kind of children (block vs inline). |
| 908 toBlock->addChildIgnoringContinuation(children()->removeChildNode(th
is, child), beforeChild); |
| 909 } else |
| 910 toBlock->children()->insertChildNode(toBlock, children()->removeChil
dNode(this, child, false), beforeChild, false); |
897 if (child == endChild) | 911 if (child == endChild) |
898 return; | 912 return; |
899 } | 913 } |
900 } | 914 } |
901 | 915 |
902 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) | 916 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) |
903 { | 917 { |
904 // makeChildrenNonInline takes a block whose children are *all* inline and i
t | 918 // makeChildrenNonInline takes a block whose children are *all* inline and i
t |
905 // makes sure that inline children are coalesced under anonymous | 919 // makes sure that inline children are coalesced under anonymous |
906 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for | 920 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for |
(...skipping 6156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7063 } | 7077 } |
7064 | 7078 |
7065 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7079 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7066 { | 7080 { |
7067 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7081 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7068 } | 7082 } |
7069 | 7083 |
7070 #endif | 7084 #endif |
7071 | 7085 |
7072 } // namespace WebCore | 7086 } // namespace WebCore |
OLD | NEW |