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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 514 |
515 // Hook |clone| up as the continuation of the middle block. | 515 // Hook |clone| up as the continuation of the middle block. |
516 if (!cloneBlock->isAnonymousBlock()) | 516 if (!cloneBlock->isAnonymousBlock()) |
517 middleBlock->setContinuation(cloneBlock); | 517 middleBlock->setContinuation(cloneBlock); |
518 | 518 |
519 // We have been reparented and are now under the fromBlock. We need | 519 // We have been reparented and are now under the fromBlock. We need |
520 // to walk up our block parent chain until we hit the containing anonymous c
olumns block. | 520 // to walk up our block parent chain until we hit the containing anonymous c
olumns block. |
521 // Once we hit the anonymous columns block we're done. | 521 // Once we hit the anonymous columns block we're done. |
522 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); | 522 RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); |
523 RenderBoxModelObject* currChild = this; | 523 RenderBoxModelObject* currChild = this; |
| 524 RenderObject* currChildNextSibling = currChild->nextSibling(); |
524 | 525 |
525 while (curr && curr != fromBlock) { | 526 while (curr && curr != fromBlock) { |
526 ASSERT(curr->isRenderBlock()); | 527 ASSERT(curr->isRenderBlock()); |
527 | 528 |
528 RenderBlock* blockCurr = toRenderBlock(curr); | 529 RenderBlock* blockCurr = toRenderBlock(curr); |
529 | 530 |
530 // Create a new clone. | 531 // Create a new clone. |
531 RenderBlock* cloneChild = cloneBlock; | 532 RenderBlock* cloneChild = cloneBlock; |
532 cloneBlock = blockCurr->clone(); | 533 cloneBlock = blockCurr->clone(); |
533 | 534 |
534 // Insert our child clone as the first child. | 535 // Insert our child clone as the first child. |
535 cloneBlock->addChildIgnoringContinuation(cloneChild, 0); | 536 cloneBlock->addChildIgnoringContinuation(cloneChild, 0); |
536 | 537 |
537 // Hook the clone up as a continuation of |curr|. Note we do encounter | 538 // Hook the clone up as a continuation of |curr|. Note we do encounter |
538 // anonymous blocks possibly as we walk up the block chain. When we spl
it an | 539 // anonymous blocks possibly as we walk up the block chain. When we spl
it an |
539 // anonymous block, there's no need to do any continuation hookup, since
we haven't | 540 // anonymous block, there's no need to do any continuation hookup, since
we haven't |
540 // actually split a real element. | 541 // actually split a real element. |
541 if (!blockCurr->isAnonymousBlock()) { | 542 if (!blockCurr->isAnonymousBlock()) { |
542 oldCont = blockCurr->continuation(); | 543 oldCont = blockCurr->continuation(); |
543 blockCurr->setContinuation(cloneBlock); | 544 blockCurr->setContinuation(cloneBlock); |
544 cloneBlock->setContinuation(oldCont); | 545 cloneBlock->setContinuation(oldCont); |
545 } | 546 } |
546 | 547 |
547 // Someone may have indirectly caused a <q> to split. When this happens
, the :after content | 548 // Someone may have indirectly caused a <q> to split. When this happens
, the :after content |
548 // has to move into the inline continuation. Call updateBeforeAfterCont
ent to ensure that the inline's :after | 549 // has to move into the inline continuation. Call updateBeforeAfterCont
ent to ensure that the inline's :after |
549 // content gets properly destroyed. | 550 // content gets properly destroyed. |
| 551 bool isLastChild = (currChildNextSibling == blockCurr->lastChild()); |
550 if (document()->usesBeforeAfterRules()) | 552 if (document()->usesBeforeAfterRules()) |
551 blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER); | 553 blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER); |
| 554 if (isLastChild && currChildNextSibling != blockCurr->lastChild()) |
| 555 currChildNextSibling = 0; // We destroyed the last child, so now we
need to update |
| 556 // the value of currChildNextSibling. |
552 | 557 |
553 // Now we need to take all of the children starting from the first child | 558 // Now we need to take all of the children starting from the first child |
554 // *after* currChild and append them all to the clone. | 559 // *after* currChild and append them all to the clone. |
555 blockCurr->moveChildrenTo(cloneBlock, currChild->nextSibling(), 0, true)
; | 560 blockCurr->moveChildrenTo(cloneBlock, currChildNextSibling, 0, true); |
556 | 561 |
557 // Keep walking up the chain. | 562 // Keep walking up the chain. |
558 currChild = curr; | 563 currChild = curr; |
| 564 currChildNextSibling = currChild->nextSibling(); |
559 curr = toRenderBoxModelObject(curr->parent()); | 565 curr = toRenderBoxModelObject(curr->parent()); |
560 } | 566 } |
561 | 567 |
562 // Now we are at the columns block level. We need to put the clone into the
toBlock. | 568 // Now we are at the columns block level. We need to put the clone into the
toBlock. |
563 toBlock->children()->appendChildNode(toBlock, cloneBlock); | 569 toBlock->children()->appendChildNode(toBlock, cloneBlock); |
564 | 570 |
565 // Now take all the children after currChild and remove them from the fromBl
ock | 571 // Now take all the children after currChild and remove them from the fromBl
ock |
566 // and put them in the toBlock. | 572 // and put them in the toBlock. |
567 fromBlock->moveChildrenTo(toBlock, currChild->nextSibling(), 0, true); | 573 fromBlock->moveChildrenTo(toBlock, currChildNextSibling, 0, true); |
568 } | 574 } |
569 | 575 |
570 void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, | 576 void RenderBlock::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox, |
571 RenderObject* newChild, RenderBoxModelObject* oldCon
t) | 577 RenderObject* newChild, RenderBoxModelObject* oldCon
t) |
572 { | 578 { |
573 RenderBlock* pre = 0; | 579 RenderBlock* pre = 0; |
574 RenderBlock* block = containingColumnsBlock(); | 580 RenderBlock* block = containingColumnsBlock(); |
575 | 581 |
576 // Delete our line boxes before we do the inline split into continuations. | 582 // Delete our line boxes before we do the inline split into continuations. |
577 block->deleteLineBoxTree(); | 583 block->deleteLineBoxTree(); |
(...skipping 6652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7230 } | 7236 } |
7231 | 7237 |
7232 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7238 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7233 { | 7239 { |
7234 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7240 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7235 } | 7241 } |
7236 | 7242 |
7237 #endif | 7243 #endif |
7238 | 7244 |
7239 } // namespace WebCore | 7245 } // namespace WebCore |
OLD | NEW |