| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 } | 547 } |
| 548 | 548 |
| 549 #if ENABLE(ASSERT) | 549 #if ENABLE(ASSERT) |
| 550 for (LayoutObject *c = firstChild(); c; c = c->nextSibling()) | 550 for (LayoutObject *c = firstChild(); c; c = c->nextSibling()) |
| 551 ASSERT(!c->isInline()); | 551 ASSERT(!c->isInline()); |
| 552 #endif | 552 #endif |
| 553 | 553 |
| 554 setShouldDoFullPaintInvalidation(); | 554 setShouldDoFullPaintInvalidation(); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void LayoutBlock::promoteAllChildrenAndInsertAfter() | |
| 558 { | |
| 559 LayoutObject* firstPromotee = firstChild(); | |
| 560 if (!firstPromotee) | |
| 561 return; | |
| 562 LayoutObject* lastPromotee = lastChild(); | |
| 563 LayoutBlock* parent = toLayoutBlock(this->parent()); | |
| 564 LayoutObject* nextSiblingOfPromotees = nextSibling(); | |
| 565 for (LayoutObject* o = firstPromotee; o; o = o->nextSibling()) | |
| 566 o->setParent(parent); | |
| 567 children()->setFirstChild(nullptr); | |
| 568 children()->setLastChild(nullptr); | |
| 569 firstPromotee->setPreviousSibling(this); | |
| 570 setNextSibling(firstPromotee); | |
| 571 lastPromotee->setNextSibling(nextSiblingOfPromotees); | |
| 572 if (nextSiblingOfPromotees) | |
| 573 nextSiblingOfPromotees->setPreviousSibling(lastPromotee); | |
| 574 if (parent->children()->lastChild() == this) | |
| 575 parent->children()->setLastChild(lastPromotee); | |
| 576 } | |
| 577 | |
| 578 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child) | 557 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child) |
| 579 { | 558 { |
| 580 ASSERT(child->isAnonymousBlock()); | 559 ASSERT(child->isAnonymousBlock()); |
| 581 ASSERT(!child->childrenInline()); | 560 ASSERT(!child->childrenInline()); |
| 582 ASSERT(child->parent() == this); | 561 ASSERT(child->parent() == this); |
| 583 | 562 |
| 584 if (child->continuation()) | 563 if (child->continuation()) |
| 585 return; | 564 return; |
| 586 | 565 |
| 587 // Promote all the leftover anonymous block's children (to become children o
f this block | 566 // Promote all the leftover anonymous block's children (to become children o
f this block |
| 588 // instead). We still want to keep the leftover block in the tree for a mome
nt, for notification | 567 // instead). We still want to keep the leftover block in the tree for a mome
nt, for notification |
| 589 // purposes done further below (flow threads and grids). | 568 // purposes done further below (flow threads and grids). |
| 590 child->promoteAllChildrenAndInsertAfter(); | 569 child->moveAllChildrenTo(this, child->nextSibling()); |
| 591 | 570 |
| 592 // Remove all the information in the flow thread associated with the leftove
r anonymous block. | 571 // Remove all the information in the flow thread associated with the leftove
r anonymous block. |
| 593 child->removeFromLayoutFlowThread(); | 572 child->removeFromLayoutFlowThread(); |
| 594 | 573 |
| 595 // LayoutGrid keeps track of its children, we must notify it about changes i
n the tree. | 574 // LayoutGrid keeps track of its children, we must notify it about changes i
n the tree. |
| 596 if (child->parent()->isLayoutGrid()) | 575 if (child->parent()->isLayoutGrid()) |
| 597 toLayoutGrid(child->parent())->dirtyGrid(); | 576 toLayoutGrid(child->parent())->dirtyGrid(); |
| 598 | 577 |
| 599 // Now remove the leftover anonymous block from the tree, and destroy it. We
'll rip it out | 578 // Now remove the leftover anonymous block from the tree, and destroy it. We
'll rip it out |
| 600 // manually from the tree before destroying it, because we don't want to tri
gger any tree | 579 // manually from the tree before destroying it, because we don't want to tri
gger any tree |
| (...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec
alcAfterStyleChange()) | 2757 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec
alcAfterStyleChange()) |
| 2779 return false; | 2758 return false; |
| 2780 | 2759 |
| 2781 ASSERT(layoutObject->isLayoutBlock()); | 2760 ASSERT(layoutObject->isLayoutBlock()); |
| 2782 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange(); | 2761 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange(); |
| 2783 } | 2762 } |
| 2784 | 2763 |
| 2785 bool LayoutBlock::recalcChildOverflowAfterStyleChange() | 2764 bool LayoutBlock::recalcChildOverflowAfterStyleChange() |
| 2786 { | 2765 { |
| 2787 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); | 2766 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); |
| 2788 setChildNeedsOverflowRecalcAfterStyleChange(false); | 2767 clearChildNeedsOverflowRecalcAfterStyleChange(); |
| 2789 | 2768 |
| 2790 bool childrenOverflowChanged = false; | 2769 bool childrenOverflowChanged = false; |
| 2791 | 2770 |
| 2792 if (childrenInline()) { | 2771 if (childrenInline()) { |
| 2793 ListHashSet<RootInlineBox*> lineBoxes; | 2772 ListHashSet<RootInlineBox*> lineBoxes; |
| 2794 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow()); | 2773 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow()); |
| 2795 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk
er.advance()) { | 2774 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk
er.advance()) { |
| 2796 LayoutObject* layoutObject = walker.current(); | 2775 LayoutObject* layoutObject = walker.current(); |
| 2797 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) { | 2776 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) { |
| 2798 childrenOverflowChanged = true; | 2777 childrenOverflowChanged = true; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 { | 2813 { |
| 2835 ASSERT(needsOverflowRecalcAfterStyleChange()); | 2814 ASSERT(needsOverflowRecalcAfterStyleChange()); |
| 2836 | 2815 |
| 2837 bool childrenOverflowChanged = false; | 2816 bool childrenOverflowChanged = false; |
| 2838 if (childNeedsOverflowRecalcAfterStyleChange()) | 2817 if (childNeedsOverflowRecalcAfterStyleChange()) |
| 2839 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); | 2818 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); |
| 2840 | 2819 |
| 2841 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) | 2820 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) |
| 2842 return false; | 2821 return false; |
| 2843 | 2822 |
| 2844 setSelfNeedsOverflowRecalcAfterStyleChange(false); | 2823 clearSelfNeedsOverflowRecalcAfterStyleChange(); |
| 2845 // If the current block needs layout, overflow will be recalculated during | 2824 // If the current block needs layout, overflow will be recalculated during |
| 2846 // layout time anyway. We can safely exit here. | 2825 // layout time anyway. We can safely exit here. |
| 2847 if (needsLayout()) | 2826 if (needsLayout()) |
| 2848 return false; | 2827 return false; |
| 2849 | 2828 |
| 2850 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien
tAfterEdge() : clientLogicalBottom(); | 2829 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien
tAfterEdge() : clientLogicalBottom(); |
| 2851 computeOverflow(oldClientAfterEdge); | 2830 computeOverflow(oldClientAfterEdge); |
| 2852 | 2831 |
| 2853 if (hasOverflowClip()) | 2832 if (hasOverflowClip()) |
| 2854 layer()->scrollableArea()->updateAfterOverflowRecalc(); | 2833 layer()->scrollableArea()->updateAfterOverflowRecalc(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2925 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2904 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2926 { | 2905 { |
| 2927 showLayoutObject(); | 2906 showLayoutObject(); |
| 2928 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2907 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2929 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2908 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2930 } | 2909 } |
| 2931 | 2910 |
| 2932 #endif | 2911 #endif |
| 2933 | 2912 |
| 2934 } // namespace blink | 2913 } // namespace blink |
| OLD | NEW |