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

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: Simplify 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
« no previous file with comments | « no previous file | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() 556 void LayoutBlock::promoteAllChildrenAndInsertAfter()
557 { 557 {
558 LayoutObject* firstPromotee = firstChild(); 558 moveAllChildrenTo(toLayoutBoxModelObject(parent()), nextSibling());
mstensho (USE GERRIT) 2015/08/24 10:37:27 Might as well get rid of promoteAllChildrenAndInse
Xianzhu 2015/08/24 16:41:34 Done.
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 } 559 }
576 560
577 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child) 561 void LayoutBlock::removeLeftoverAnonymousBlock(LayoutBlock* child)
578 { 562 {
579 ASSERT(child->isAnonymousBlock()); 563 ASSERT(child->isAnonymousBlock());
580 ASSERT(!child->childrenInline()); 564 ASSERT(!child->childrenInline());
581 ASSERT(child->parent() == this); 565 ASSERT(child->parent() == this);
582 566
583 if (child->continuation()) 567 if (child->continuation())
584 return; 568 return;
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec alcAfterStyleChange()) 2755 if (layoutObject->isOutOfFlowPositioned() || !layoutObject->needsOverflowRec alcAfterStyleChange())
2772 return false; 2756 return false;
2773 2757
2774 ASSERT(layoutObject->isLayoutBlock()); 2758 ASSERT(layoutObject->isLayoutBlock());
2775 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange(); 2759 return toLayoutBlock(layoutObject)->recalcOverflowAfterStyleChange();
2776 } 2760 }
2777 2761
2778 bool LayoutBlock::recalcChildOverflowAfterStyleChange() 2762 bool LayoutBlock::recalcChildOverflowAfterStyleChange()
2779 { 2763 {
2780 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); 2764 ASSERT(childNeedsOverflowRecalcAfterStyleChange());
2781 setChildNeedsOverflowRecalcAfterStyleChange(false); 2765 clearChildNeedsOverflowRecalcAfterStyleChange();
2782 2766
2783 bool childrenOverflowChanged = false; 2767 bool childrenOverflowChanged = false;
2784 2768
2785 if (childrenInline()) { 2769 if (childrenInline()) {
2786 ListHashSet<RootInlineBox*> lineBoxes; 2770 ListHashSet<RootInlineBox*> lineBoxes;
2787 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow()); 2771 ASSERT_WITH_SECURITY_IMPLICATION(isLayoutBlockFlow());
2788 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk er.advance()) { 2772 for (InlineWalker walker(toLayoutBlockFlow(this)); !walker.atEnd(); walk er.advance()) {
2789 LayoutObject* layoutObject = walker.current(); 2773 LayoutObject* layoutObject = walker.current();
2790 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) { 2774 if (recalcNormalFlowChildOverflowIfNeeded(layoutObject)) {
2791 childrenOverflowChanged = true; 2775 childrenOverflowChanged = true;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 { 2811 {
2828 ASSERT(needsOverflowRecalcAfterStyleChange()); 2812 ASSERT(needsOverflowRecalcAfterStyleChange());
2829 2813
2830 bool childrenOverflowChanged = false; 2814 bool childrenOverflowChanged = false;
2831 if (childNeedsOverflowRecalcAfterStyleChange()) 2815 if (childNeedsOverflowRecalcAfterStyleChange())
2832 childrenOverflowChanged = recalcChildOverflowAfterStyleChange(); 2816 childrenOverflowChanged = recalcChildOverflowAfterStyleChange();
2833 2817
2834 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged) 2818 if (!selfNeedsOverflowRecalcAfterStyleChange() && !childrenOverflowChanged)
2835 return false; 2819 return false;
2836 2820
2837 setSelfNeedsOverflowRecalcAfterStyleChange(false); 2821 clearSelfNeedsOverflowRecalcAfterStyleChange();
2838 // If the current block needs layout, overflow will be recalculated during 2822 // If the current block needs layout, overflow will be recalculated during
2839 // layout time anyway. We can safely exit here. 2823 // layout time anyway. We can safely exit here.
2840 if (needsLayout()) 2824 if (needsLayout())
2841 return false; 2825 return false;
2842 2826
2843 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien tAfterEdge() : clientLogicalBottom(); 2827 LayoutUnit oldClientAfterEdge = hasOverflowModel() ? m_overflow->layoutClien tAfterEdge() : clientLogicalBottom();
2844 computeOverflow(oldClientAfterEdge); 2828 computeOverflow(oldClientAfterEdge);
2845 2829
2846 if (hasOverflowClip()) 2830 if (hasOverflowClip())
2847 layer()->scrollableArea()->updateAfterOverflowRecalc(); 2831 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 2902 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2919 { 2903 {
2920 showLayoutObject(); 2904 showLayoutObject();
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2905 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2906 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2923 } 2907 }
2924 2908
2925 #endif 2909 #endif
2926 2910
2927 } // namespace blink 2911 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698