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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 440 |
441 if (currBlock->isAnonymousColumnSpanBlock()) | 441 if (currBlock->isAnonymousColumnSpanBlock()) |
442 return 0; | 442 return 0; |
443 } | 443 } |
444 return 0; | 444 return 0; |
445 } | 445 } |
446 | 446 |
447 RenderBlock* RenderBlock::clone() const | 447 RenderBlock* RenderBlock::clone() const |
448 { | 448 { |
449 RenderBlock* cloneBlock; | 449 RenderBlock* cloneBlock; |
450 if (isAnonymousBlock()) | 450 if (isAnonymousBlock()) { |
451 cloneBlock = createAnonymousBlock(); | 451 cloneBlock = createAnonymousBlock(); |
| 452 cloneBlock->setChildrenInline(childrenInline()); |
| 453 } |
452 else { | 454 else { |
453 cloneBlock = new (renderArena()) RenderBlock(node()); | 455 cloneBlock = new (renderArena()) RenderBlock(node()); |
454 cloneBlock->setStyle(style()); | 456 cloneBlock->setStyle(style()); |
455 if (!childrenInline() && cloneBlock->firstChild() && cloneBlock->firstCh
ild()->isInline()) | 457 |
456 cloneBlock->makeChildrenNonInline(); | 458 // This takes care of setting the right value of childrenInline in case |
| 459 // generated content is added to cloneBlock and 'this' does not have |
| 460 // generated content added yet. |
| 461 cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->fir
stChild()->isInline() : childrenInline()); |
457 } | 462 } |
458 cloneBlock->setChildrenInline(childrenInline()); | |
459 return cloneBlock; | 463 return cloneBlock; |
460 } | 464 } |
461 | 465 |
462 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, | 466 void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, |
463 RenderBlock* middleBlock, | 467 RenderBlock* middleBlock, |
464 RenderObject* beforeChild, RenderBoxModelObject* o
ldCont) | 468 RenderObject* beforeChild, RenderBoxModelObject* o
ldCont) |
465 { | 469 { |
466 // Create a clone of this inline. | 470 // Create a clone of this inline. |
467 RenderBlock* cloneBlock = clone(); | 471 RenderBlock* cloneBlock = clone(); |
468 if (!isAnonymousBlock()) | 472 if (!isAnonymousBlock()) |
(...skipping 18 matching lines...) Expand all Loading... |
487 while (curr && curr != fromBlock) { | 491 while (curr && curr != fromBlock) { |
488 ASSERT(curr->isRenderBlock()); | 492 ASSERT(curr->isRenderBlock()); |
489 | 493 |
490 RenderBlock* blockCurr = toRenderBlock(curr); | 494 RenderBlock* blockCurr = toRenderBlock(curr); |
491 | 495 |
492 // Create a new clone. | 496 // Create a new clone. |
493 RenderBlock* cloneChild = cloneBlock; | 497 RenderBlock* cloneChild = cloneBlock; |
494 cloneBlock = blockCurr->clone(); | 498 cloneBlock = blockCurr->clone(); |
495 | 499 |
496 // Insert our child clone as the first child. | 500 // Insert our child clone as the first child. |
497 cloneBlock->children()->appendChildNode(cloneBlock, cloneChild); | 501 cloneBlock->addChildIgnoringContinuation(cloneChild, 0); |
498 | 502 |
499 // Hook the clone up as a continuation of |curr|. Note we do encounter | 503 // Hook the clone up as a continuation of |curr|. Note we do encounter |
500 // anonymous blocks possibly as we walk up the block chain. When we spl
it an | 504 // anonymous blocks possibly as we walk up the block chain. When we spl
it an |
501 // anonymous block, there's no need to do any continuation hookup, since
we haven't | 505 // anonymous block, there's no need to do any continuation hookup, since
we haven't |
502 // actually split a real element. | 506 // actually split a real element. |
503 if (!blockCurr->isAnonymousBlock()) { | 507 if (!blockCurr->isAnonymousBlock()) { |
504 oldCont = blockCurr->continuation(); | 508 oldCont = blockCurr->continuation(); |
505 blockCurr->setContinuation(cloneBlock); | 509 blockCurr->setContinuation(cloneBlock); |
506 cloneBlock->setContinuation(oldCont); | 510 cloneBlock->setContinuation(oldCont); |
507 } | 511 } |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 return new (renderArena()) RootInlineBox(this); | 882 return new (renderArena()) RootInlineBox(this); |
879 } | 883 } |
880 | 884 |
881 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() | 885 RootInlineBox* RenderBlock::createAndAppendRootInlineBox() |
882 { | 886 { |
883 RootInlineBox* rootBox = createRootInlineBox(); | 887 RootInlineBox* rootBox = createRootInlineBox(); |
884 m_lineBoxes.appendLineBox(rootBox); | 888 m_lineBoxes.appendLineBox(rootBox); |
885 return rootBox; | 889 return rootBox; |
886 } | 890 } |
887 | 891 |
888 void RenderBlock::moveChildTo(RenderBlock* to, RenderObject* child, RenderObject
* beforeChild, bool fullRemoveInsert) | 892 void RenderBlock::moveChildTo(RenderBlock* toBlock, RenderObject* child, RenderO
bject* beforeChild, bool fullRemoveInsert) |
889 { | 893 { |
890 ASSERT(this == child->parent()); | 894 ASSERT(this == child->parent()); |
891 ASSERT(!beforeChild || to == beforeChild->parent()); | 895 ASSERT(!beforeChild || toBlock == beforeChild->parent()); |
892 to->children()->insertChildNode(to, children()->removeChildNode(this, child,
fullRemoveInsert), beforeChild, fullRemoveInsert); | 896 if (fullRemoveInsert) { |
| 897 // Takes care of adding the new child correctly if toBlock and fromBlock |
| 898 // have different kind of children (block vs inline). |
| 899 toBlock->addChildIgnoringContinuation(children()->removeChildNode(this,
child), beforeChild); |
| 900 } else |
| 901 toBlock->children()->insertChildNode(toBlock, children()->removeChildNod
e(this, child, false), beforeChild, false); |
893 } | 902 } |
894 | 903 |
895 void RenderBlock::moveChildrenTo(RenderBlock* to, RenderObject* startChild, Rend
erObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert) | 904 void RenderBlock::moveChildrenTo(RenderBlock* toBlock, RenderObject* startChild,
RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert) |
896 { | 905 { |
897 ASSERT(!beforeChild || to == beforeChild->parent()); | 906 ASSERT(!beforeChild || toBlock == beforeChild->parent()); |
898 RenderObject* nextChild = startChild; | 907 RenderObject* nextChild = startChild; |
899 while (nextChild && nextChild != endChild) { | 908 while (nextChild && nextChild != endChild) { |
900 RenderObject* child = nextChild; | 909 RenderObject* child = nextChild; |
901 nextChild = child->nextSibling(); | 910 nextChild = child->nextSibling(); |
902 to->children()->insertChildNode(to, children()->removeChildNode(this, ch
ild, fullRemoveInsert), beforeChild, fullRemoveInsert); | 911 if (fullRemoveInsert) { |
| 912 // Takes care of adding the new child correctly if toBlock and fromB
lock |
| 913 // have different kind of children (block vs inline). |
| 914 toBlock->addChildIgnoringContinuation(children()->removeChildNode(th
is, child), beforeChild); |
| 915 } else |
| 916 toBlock->children()->insertChildNode(toBlock, children()->removeChil
dNode(this, child, false), beforeChild, false); |
903 if (child == endChild) | 917 if (child == endChild) |
904 return; | 918 return; |
905 } | 919 } |
906 } | 920 } |
907 | 921 |
908 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) | 922 void RenderBlock::makeChildrenNonInline(RenderObject *insertionPoint) |
909 { | 923 { |
910 // makeChildrenNonInline takes a block whose children are *all* inline and i
t | 924 // makeChildrenNonInline takes a block whose children are *all* inline and i
t |
911 // makes sure that inline children are coalesced under anonymous | 925 // makes sure that inline children are coalesced under anonymous |
912 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for | 926 // blocks. If |insertionPoint| is defined, then it represents the insertion
point for |
(...skipping 6181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7094 } | 7108 } |
7095 | 7109 |
7096 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7110 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7097 { | 7111 { |
7098 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7112 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7099 } | 7113 } |
7100 | 7114 |
7101 #endif | 7115 #endif |
7102 | 7116 |
7103 } // namespace WebCore | 7117 } // namespace WebCore |
OLD | NEW |