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