| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA
uto()) | 368 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA
uto()) |
| 369 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations)
; | 369 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations)
; |
| 370 } | 370 } |
| 371 | 371 |
| 372 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint
InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR
ect* paintInvalidationRect) const | 372 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint
InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR
ect* paintInvalidationRect) const |
| 373 { | 373 { |
| 374 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida
tionReason, paintInvalidationRect); | 374 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida
tionReason, paintInvalidationRect); |
| 375 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); | 375 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); |
| 376 } | 376 } |
| 377 | 377 |
| 378 static void addNextFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, Layout
Block* container) |
| 379 { |
| 380 LayoutObject* child = block->nextSibling(); |
| 381 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
| 382 LayoutObject* sibling = child->nextSibling(); |
| 383 container->moveChildTo(block, child, nullptr, false); |
| 384 child = sibling; |
| 385 } |
| 386 } |
| 387 |
| 388 static void addPreviousFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, La
youtBlock* container) |
| 389 { |
| 390 LayoutObject* child = block->previousSibling(); |
| 391 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
| 392 LayoutObject* sibling = child->previousSibling(); |
| 393 container->moveChildTo(block, child, block->firstChild(), false); |
| 394 child = sibling; |
| 395 } |
| 396 } |
| 397 |
| 378 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
ect* beforeChild) | 398 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
ect* beforeChild) |
| 379 { | 399 { |
| 380 if (beforeChild && beforeChild->parent() != this) { | 400 if (beforeChild && beforeChild->parent() != this) { |
| 381 LayoutObject* beforeChildContainer = beforeChild->parent(); | 401 LayoutObject* beforeChildContainer = beforeChild->parent(); |
| 382 while (beforeChildContainer->parent() != this) | 402 while (beforeChildContainer->parent() != this) |
| 383 beforeChildContainer = beforeChildContainer->parent(); | 403 beforeChildContainer = beforeChildContainer->parent(); |
| 384 ASSERT(beforeChildContainer); | 404 ASSERT(beforeChildContainer); |
| 385 | 405 |
| 386 if (beforeChildContainer->isAnonymous()) { | 406 if (beforeChildContainer->isAnonymous()) { |
| 387 // If the requested beforeChild is not one of our children, then thi
s is because | 407 // If the requested beforeChild is not one of our children, then thi
s is because |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 if (afterChild && afterChild->isAnonymousBlock()) { | 462 if (afterChild && afterChild->isAnonymousBlock()) { |
| 443 afterChild->addChild(newChild); | 463 afterChild->addChild(newChild); |
| 444 return; | 464 return; |
| 445 } | 465 } |
| 446 | 466 |
| 447 if (newChild->isInline()) { | 467 if (newChild->isInline()) { |
| 448 // No suitable existing anonymous box - create a new one. | 468 // No suitable existing anonymous box - create a new one. |
| 449 LayoutBlock* newBox = createAnonymousBlock(); | 469 LayoutBlock* newBox = createAnonymousBlock(); |
| 450 LayoutBox::addChild(newBox, beforeChild); | 470 LayoutBox::addChild(newBox, beforeChild); |
| 451 // Reparent adjacent floating or out-of-flow siblings to the new box
. | 471 // Reparent adjacent floating or out-of-flow siblings to the new box
. |
| 452 LayoutObject* child = newBox->previousSibling(); | 472 addPreviousFloatingOrOutOfFlowSiblingsToBlock(newBox, this); |
| 453 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
| 454 LayoutObject* sibling = child->previousSibling(); | |
| 455 moveChildTo(newBox, child, newBox->firstChild(), false); | |
| 456 child = sibling; | |
| 457 } | |
| 458 newBox->addChild(newChild); | 473 newBox->addChild(newChild); |
| 459 child = newBox->nextSibling(); | 474 addNextFloatingOrOutOfFlowSiblingsToBlock(newBox, this); |
| 460 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
| 461 LayoutObject* sibling = child->nextSibling(); | |
| 462 moveChildTo(newBox, child, nullptr, false); | |
| 463 child = sibling; | |
| 464 } | |
| 465 return; | 475 return; |
| 466 } | 476 } |
| 467 } | 477 } |
| 468 | 478 |
| 469 LayoutBox::addChild(newChild, beforeChild); | 479 LayoutBox::addChild(newChild, beforeChild); |
| 470 | 480 |
| 471 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock()) | 481 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock()) |
| 472 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 482 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
| 473 // this object may be dead here | 483 // this object may be dead here |
| 474 } | 484 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 collapseAnonymousBlockChild(this, toLayoutBlock(child)); | 731 collapseAnonymousBlockChild(this, toLayoutBlock(child)); |
| 722 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | 732 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { |
| 723 // It's possible that the removal has knocked us down to a single anonym
ous | 733 // It's possible that the removal has knocked us down to a single anonym
ous |
| 724 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 734 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
| 725 // are floating, then we need to pull the content up also. | 735 // are floating, then we need to pull the content up also. |
| 726 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); | 736 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); |
| 727 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) | 737 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) |
| 728 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) | 738 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) |
| 729 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { | 739 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { |
| 730 collapseAnonymousBlockChild(this, anonymousBlock); | 740 collapseAnonymousBlockChild(this, anonymousBlock); |
| 741 } else { |
| 742 // If we have floating or out-of-flow siblings now adjacent to an an
onymous block, fold them |
| 743 // into it. |
| 744 if (prev && prev->isAnonymousBlock()) |
| 745 addNextFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(prev), t
his); |
| 746 else if (next && next->isAnonymousBlock()) |
| 747 addPreviousFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(next
), this); |
| 731 } | 748 } |
| 732 } | 749 } |
| 733 | 750 |
| 734 if (!firstChild()) { | 751 if (!firstChild()) { |
| 735 // If this was our last child be sure to clear out our line boxes. | 752 // If this was our last child be sure to clear out our line boxes. |
| 736 if (childrenInline()) | 753 if (childrenInline()) |
| 737 deleteLineBoxTree(); | 754 deleteLineBoxTree(); |
| 738 | 755 |
| 739 // If we are an empty anonymous block in the continuation chain, | 756 // If we are an empty anonymous block in the continuation chain, |
| 740 // we need to remove ourself and fix the continuation chain. | 757 // we need to remove ourself and fix the continuation chain. |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2905 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2889 { | 2906 { |
| 2890 showLayoutObject(); | 2907 showLayoutObject(); |
| 2891 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2908 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2892 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2909 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2893 } | 2910 } |
| 2894 | 2911 |
| 2895 #endif | 2912 #endif |
| 2896 | 2913 |
| 2897 } // namespace blink | 2914 } // namespace blink |
| OLD | NEW |