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