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 if (block->beingDestroyed()) |
| 381 return; |
| 382 |
| 383 LayoutObject* child = block->nextSibling(); |
| 384 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
| 385 LayoutObject* sibling = child->nextSibling(); |
| 386 container->moveChildTo(block, child, nullptr, false); |
| 387 child = sibling; |
| 388 } |
| 389 } |
| 390 |
| 391 static void addPreviousFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, La
youtBlock* container) |
| 392 { |
| 393 if (block->beingDestroyed()) |
| 394 return; |
| 395 |
| 396 LayoutObject* child = block->previousSibling(); |
| 397 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
| 398 LayoutObject* sibling = child->previousSibling(); |
| 399 container->moveChildTo(block, child, block->firstChild(), false); |
| 400 child = sibling; |
| 401 } |
| 402 } |
| 403 |
378 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
ect* beforeChild) | 404 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj
ect* beforeChild) |
379 { | 405 { |
380 if (beforeChild && beforeChild->parent() != this) { | 406 if (beforeChild && beforeChild->parent() != this) { |
381 LayoutObject* beforeChildContainer = beforeChild->parent(); | 407 LayoutObject* beforeChildContainer = beforeChild->parent(); |
382 while (beforeChildContainer->parent() != this) | 408 while (beforeChildContainer->parent() != this) |
383 beforeChildContainer = beforeChildContainer->parent(); | 409 beforeChildContainer = beforeChildContainer->parent(); |
384 ASSERT(beforeChildContainer); | 410 ASSERT(beforeChildContainer); |
385 | 411 |
386 if (beforeChildContainer->isAnonymous()) { | 412 if (beforeChildContainer->isAnonymous()) { |
387 // If the requested beforeChild is not one of our children, then thi
s is because | 413 // 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()) { | 468 if (afterChild && afterChild->isAnonymousBlock()) { |
443 afterChild->addChild(newChild); | 469 afterChild->addChild(newChild); |
444 return; | 470 return; |
445 } | 471 } |
446 | 472 |
447 if (newChild->isInline()) { | 473 if (newChild->isInline()) { |
448 // No suitable existing anonymous box - create a new one. | 474 // No suitable existing anonymous box - create a new one. |
449 LayoutBlock* newBox = createAnonymousBlock(); | 475 LayoutBlock* newBox = createAnonymousBlock(); |
450 LayoutBox::addChild(newBox, beforeChild); | 476 LayoutBox::addChild(newBox, beforeChild); |
451 // Reparent adjacent floating or out-of-flow siblings to the new box
. | 477 // Reparent adjacent floating or out-of-flow siblings to the new box
. |
452 LayoutObject* child = newBox->previousSibling(); | 478 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); | 479 newBox->addChild(newChild); |
459 child = newBox->nextSibling(); | 480 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; | 481 return; |
466 } | 482 } |
467 } | 483 } |
468 | 484 |
469 LayoutBox::addChild(newChild, beforeChild); | 485 LayoutBox::addChild(newChild, beforeChild); |
470 | 486 |
471 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock()) | 487 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo
utBlock()) |
472 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 488 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
473 // this object may be dead here | 489 // this object may be dead here |
474 } | 490 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 collapseAnonymousBlockChild(this, toLayoutBlock(child)); | 748 collapseAnonymousBlockChild(this, toLayoutBlock(child)); |
733 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | 749 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { |
734 // It's possible that the removal has knocked us down to a single anonym
ous | 750 // It's possible that the removal has knocked us down to a single anonym
ous |
735 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 751 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
736 // are floating, then we need to pull the content up also. | 752 // are floating, then we need to pull the content up also. |
737 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); | 753 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl
ock()) ? prev : next); |
738 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) | 754 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) |
739 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) | 755 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS
ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()-
>isFloating() && !anonymousBlock->previousSibling()->previousSibling())) |
740 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { | 756 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()
->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating(
) && !anonymousBlock->nextSibling()->nextSibling()))) { |
741 collapseAnonymousBlockChild(this, anonymousBlock); | 757 collapseAnonymousBlockChild(this, anonymousBlock); |
| 758 } else { |
| 759 // If we have floating or out-of-flow siblings now adjacent to an an
onymous block, fold them |
| 760 // into it. |
| 761 if (prev && prev->isAnonymousBlock()) |
| 762 addNextFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(prev), t
his); |
| 763 else if (next && next->isAnonymousBlock()) |
| 764 addPreviousFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(next
), this); |
742 } | 765 } |
743 } | 766 } |
744 | 767 |
745 if (!firstChild()) { | 768 if (!firstChild()) { |
746 // If this was our last child be sure to clear out our line boxes. | 769 // If this was our last child be sure to clear out our line boxes. |
747 if (childrenInline()) | 770 if (childrenInline()) |
748 deleteLineBoxTree(); | 771 deleteLineBoxTree(); |
749 | 772 |
750 // If we are an empty anonymous block in the continuation chain, | 773 // If we are an empty anonymous block in the continuation chain, |
751 // we need to remove ourself and fix the continuation chain. | 774 // we need to remove ourself and fix the continuation chain. |
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2934 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
2912 { | 2935 { |
2913 showLayoutObject(); | 2936 showLayoutObject(); |
2914 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2937 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
2915 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2938 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
2916 } | 2939 } |
2917 | 2940 |
2918 #endif | 2941 #endif |
2919 | 2942 |
2920 } // namespace blink | 2943 } // namespace blink |
OLD | NEW |