Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: Source/core/layout/LayoutBlock.cpp

Issue 1306993002: Cleanup friends of LayoutObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove LayoutBlock::promoteAllChildrenAndInsertAfter Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 547
548 #if ENABLE(ASSERT) 548 #if ENABLE(ASSERT)
549 for (LayoutObject *c = firstChild(); c; c = c->nextSibling()) 549 for (LayoutObject *c = firstChild(); c; c = c->nextSibling())
550 ASSERT(!c->isInline()); 550 ASSERT(!c->isInline());
551 #endif 551 #endif
552 552
553 setShouldDoFullPaintInvalidation(); 553 setShouldDoFullPaintInvalidation();
554 } 554 }
555 555
556 void LayoutBlock::promoteAllChildrenAndInsertAfter()
557 {
558 LayoutObject* firstPromotee = firstChild();
559 if (!firstPromotee)
560 return;
561 LayoutObject* lastPromotee = lastChild();
562 LayoutBlock* parent = toLayoutBlock(this->parent());
563 LayoutObject* nextSiblingOfPromotees = nextSibling();
564 for (LayoutObject* o = firstPromotee; o; o = o->nextSibling())
565 o->setParent(parent);
566 children()->setFirstChild(nullptr);
567 children()->setLastChild(nullptr);
568 firstPromotee->setPreviousSibling(this);
569 setNextSibling(firstPromotee);
570 lastPromotee->setNextSibling(nextSiblingOfPromotees);
571 if (nextSiblingOfPromotees)
572 nextSiblingOfPromotees->setPreviousSibling(lastPromotee);
573 if (parent->children()->lastChild() == this)
574 parent->children()->setLastChild(lastPromotee);
575 }
576
577 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child) 556 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child)
578 { 557 {
579 ASSERT(child->isAnonymousBlock()); 558 ASSERT(child->isAnonymousBlock());
580 ASSERT(!child->childrenInline()); 559 ASSERT(!child->childrenInline());
581 ASSERT(child->parent() == this); 560 ASSERT(child->parent() == this);
582 561
583 if (child->continuation()) 562 if (child->continuation())
584 return; 563 return;
585 564
586 // Promote all the leftover anonymous block's children (to become children o f this block 565 // Promote all the leftover anonymous block's children (to become children o f this block
587 // instead). We still want to keep the leftover block in the tree for a mome nt, for notification 566 // instead). We still want to keep the leftover block in the tree for a mome nt, for notification
588 // purposes done further below (flow threads and grids). 567 // purposes done further below (flow threads and grids).
589 child->promoteAllChildrenAndInsertAfter(); 568 child->moveAllChildrenTo(this, child->nextSibling());
590 569
591 // Remove all the information in the flow thread associated with the leftove r anonymous block. 570 // Remove all the information in the flow thread associated with the leftove r anonymous block.
592 child->removeFromLayoutFlowThread(); 571 child->removeFromLayoutFlowThread();
593 572
594 // LayoutGrid keeps track of its children, we must notify it about changes i n the tree. 573 // LayoutGrid keeps track of its children, we must notify it about changes i n the tree.
595 if (child->parent()->isLayoutGrid()) 574 if (child->parent()->isLayoutGrid())
596 toLayoutGrid(child->parent())->dirtyGrid(); 575 toLayoutGrid(child->parent())->dirtyGrid();
597 576
598 // Now remove the leftover anonymous block from the tree, and destroy it. We 'll rip it out 577 // Now remove the leftover anonymous block from the tree, and destroy it. We 'll rip it out
599 // manually from the tree before destroying it, because we don't want to tri gger any tree 578 // manually from the tree before destroying it, because we don't want to tri gger any tree
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec alcAfterStyleChange()) 2750 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec alcAfterStyleChange())
2772 return false; 2751 return false;
2773 2752
2774 ASSERT(layoutObject->isLayoutBlock()); 2753 ASSERT(layoutObject->isLayoutBlock());
2775 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange(); 2754 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange();
2776 } 2755 }
2777 2756
2778 bool LayoutBlock::recalcChildOverflowAfterStyleChange() 2757 bool LayoutBlock::recalcChildOverflowAfterStyleChange()
2779 { 2758 {
2780 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); 2759 ASSERT(childNeedsOverflowRecalcAfterStyleChange());
2781 setChildNeedsOverflowRecalcAfterStyleChange(false); 2760 clearChildNeedsOverflowRecalcAfterStyleChange();
2782 2761
2783 bool childrenOverflowChanged = false; 2762 bool childrenOverflowChanged = false;
2784 2763
2785 if (childrenInline()) { 2764 if (childrenInline()) {
2786 ListHashSet<RootInlineBox*> lineBoxes; 2765 ListHashSet<RootInlineBox*> lineBoxes;
2787 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow()); 2766 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow());
2788 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk er.advance()) { 2767 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk er.advance()) {
2789 LayoutObject* layoutObject = walker.current(); 2768 LayoutObject* layoutObject = walker.current();
2790 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) { 2769 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) {
2791 childrenOverflowChanged = true; 2770 childrenOverflowChanged = true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 { 2806 {
2828 ASSERT(needsOverflowRecalcAfterStyleChange()); 2807 ASSERT(needsOverflowRecalcAfterStyleChange());
2829 2808
2830 bool childrenOverflowChanged = false; 2809 bool childrenOverflowChanged = false;
2831 if (childNeedsOverflowRecalcAfterStyleChange()) 2810 if (childNeedsOverflowRecalcAfterStyleChange())
2832 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); 2811 childrenOverflowChanged = recalcChildOverflowAfterStyleChange();
2833 2812
2834 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) 2813 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged)
2835 return false; 2814 return false;
2836 2815
2837 setSelfNeedsOverflowRecalcAfterStyleChange(false); 2816 clearSelfNeedsOverflowRecalcAfterStyleChange();
2838 // If the current block needs layout, overflow will be recalculated during 2817 // If the current block needs layout, overflow will be recalculated during
2839 // layout time anyway. We can safely exit here. 2818 // layout time anyway. We can safely exit here.
2840 if (needsLayout()) 2819 if (needsLayout())
2841 return false; 2820 return false;
2842 2821
2843 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien tAfterEdge() : clientLogicalBottom(); 2822 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien tAfterEdge() : clientLogicalBottom();
2844 computeOverflow(oldClientAfterEdge); 2823 computeOverflow(oldClientAfterEdge);
2845 2824
2846 if (hasOverflowClip()) 2825 if (hasOverflowClip())
2847 layer()->scrollableArea()->updateAfterOverflowRecalc(); 2826 layer()->scrollableArea()->updateAfterOverflowRecalc();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2897 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2919 { 2898 {
2920 showLayoutObject(); 2899 showLayoutObject();
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2900 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2901 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2923 } 2902 }
2924 2903
2925 #endif 2904 #endif
2926 2905
2927 } // namespace blink 2906 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698