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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA uto()) | 362 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA uto()) |
363 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations) ; | 363 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations) ; |
364 } | 364 } |
365 | 365 |
366 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR ect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const | 366 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR ect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const |
367 { | 367 { |
368 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida tionReason, previousPaintInvalidationRect, newPaintInvalidationRect); | 368 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida tionReason, previousPaintInvalidationRect, newPaintInvalidationRect); |
369 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); | 369 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); |
370 } | 370 } |
371 | 371 |
372 static void addSubsequentFloatingOrOutOfFlowSiblingsToBlock(LayoutBlock* block, LayoutBlock* container) | |
373 { | |
374 LayoutObject* child = block->nextSibling(); | |
375 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
376 LayoutObject* sibling = child->nextSibling(); | |
377 container->moveChildTo(block, child, nullptr, false); | |
378 child = sibling; | |
379 } | |
380 } | |
381 | |
372 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj ect* beforeChild) | 382 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj ect* beforeChild) |
373 { | 383 { |
374 if (beforeChild && beforeChild->parent() != this) { | 384 if (beforeChild && beforeChild->parent() != this) { |
375 LayoutObject* beforeChildContainer = beforeChild->parent(); | 385 LayoutObject* beforeChildContainer = beforeChild->parent(); |
376 while (beforeChildContainer->parent() != this) | 386 while (beforeChildContainer->parent() != this) |
377 beforeChildContainer = beforeChildContainer->parent(); | 387 beforeChildContainer = beforeChildContainer->parent(); |
378 ASSERT(beforeChildContainer); | 388 ASSERT(beforeChildContainer); |
379 | 389 |
380 if (beforeChildContainer->isAnonymous()) { | 390 if (beforeChildContainer->isAnonymous()) { |
381 // If the requested beforeChild is not one of our children, then thi s is because | 391 // If the requested beforeChild is not one of our children, then thi s is because |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
443 LayoutBlock* newBox = createAnonymousBlock(); | 453 LayoutBlock* newBox = createAnonymousBlock(); |
444 LayoutBox::addChild(newBox, beforeChild); | 454 LayoutBox::addChild(newBox, beforeChild); |
445 // Reparent adjacent floating or out-of-flow siblings to the new box . | 455 // Reparent adjacent floating or out-of-flow siblings to the new box . |
446 LayoutObject* child = newBox->previousSibling(); | 456 LayoutObject* child = newBox->previousSibling(); |
447 while (child && child->isFloatingOrOutOfFlowPositioned()) { | 457 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
448 LayoutObject* sibling = child->previousSibling(); | 458 LayoutObject* sibling = child->previousSibling(); |
449 moveChildTo(newBox, child, newBox->firstChild(), false); | 459 moveChildTo(newBox, child, newBox->firstChild(), false); |
450 child = sibling; | 460 child = sibling; |
451 } | 461 } |
452 newBox->addChild(newChild); | 462 newBox->addChild(newChild); |
453 child = newBox->nextSibling(); | 463 addSubsequentFloatingOrOutOfFlowSiblingsToBlock(newBox, this); |
454 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
455 LayoutObject* sibling = child->nextSibling(); | |
456 moveChildTo(newBox, child, nullptr, false); | |
457 child = sibling; | |
458 } | |
459 return; | 464 return; |
460 } | 465 } |
461 } | 466 } |
462 | 467 |
463 LayoutBox::addChild(newChild, beforeChild); | 468 LayoutBox::addChild(newChild, beforeChild); |
464 | 469 |
465 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) | 470 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) |
466 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 471 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
467 // this object may be dead here | 472 // this object may be dead here |
468 } | 473 } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous Block())) && canCollapseAnonymousBlockChild()) { | 728 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous Block())) && canCollapseAnonymousBlockChild()) { |
724 // It's possible that the removal has knocked us down to a single anonym ous | 729 // It's possible that the removal has knocked us down to a single anonym ous |
725 // block with pseudo-style element siblings (e.g. first-letter). If thes e | 730 // block with pseudo-style element siblings (e.g. first-letter). If thes e |
726 // are floating, then we need to pull the content up also. | 731 // are floating, then we need to pull the content up also. |
727 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl ock()) ? prev : next); | 732 LayoutBlock* anonymousBlock = toLayoutBlock((prev && prev->isAnonymousBl ock()) ? prev : next); |
728 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) | 733 if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) |
729 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()- >isFloating() && !anonymousBlock->previousSibling()->previousSibling())) | 734 && (!anonymousBlock->previousSibling() || (anonymousBlock->previousS ibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()- >isFloating() && !anonymousBlock->previousSibling()->previousSibling())) |
730 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling() ->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating( ) && !anonymousBlock->nextSibling()->nextSibling()))) { | 735 && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling() ->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating( ) && !anonymousBlock->nextSibling()->nextSibling()))) { |
731 collapseAnonymousBlockChild(this, anonymousBlock); | 736 collapseAnonymousBlockChild(this, anonymousBlock); |
732 } | 737 } |
738 if (prev && prev->isAnonymousBlock()) | |
mstensho (USE GERRIT)
2015/10/30 08:15:14
Don't we also need something similar for |next|?
rhogan
2015/10/30 19:28:16
I would expect https://codereview.chromium.org/142
mstensho (USE GERRIT)
2015/11/02 12:31:57
Actually, the test in this CL also passes with onl
rhogan
2015/11/02 19:38:05
Oops, fixed the test - it was missing a <div> befo
| |
739 addSubsequentFloatingOrOutOfFlowSiblingsToBlock(toLayoutBlock(prev), this); | |
733 } | 740 } |
734 | 741 |
735 if (!firstChild()) { | 742 if (!firstChild()) { |
736 // If this was our last child be sure to clear out our line boxes. | 743 // If this was our last child be sure to clear out our line boxes. |
737 if (childrenInline()) | 744 if (childrenInline()) |
738 deleteLineBoxTree(); | 745 deleteLineBoxTree(); |
739 | 746 |
740 // If we are an empty anonymous block in the continuation chain, | 747 // If we are an empty anonymous block in the continuation chain, |
741 // we need to remove ourself and fix the continuation chain. | 748 // we need to remove ourself and fix the continuation chain. |
742 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is ListMarker()) { | 749 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is ListMarker()) { |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2880 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const | 2887 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const |
2881 { | 2888 { |
2882 showLayoutObject(); | 2889 showLayoutObject(); |
2883 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 2890 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
2884 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 2891 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
2885 } | 2892 } |
2886 | 2893 |
2887 #endif | 2894 #endif |
2888 | 2895 |
2889 } // namespace blink | 2896 } // namespace blink |
OLD | NEW |