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

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

Issue 1968403002: LayoutBlock::removeChild() override no longer needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return; 637 return;
638 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::ChildAnonymousBlockChanged); 638 parent->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInva lidationReason::ChildAnonymousBlockChanged);
639 639
640 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer()); 640 child->moveAllChildrenTo(parent, child->nextSibling(), child->hasLayer());
641 parent->setChildrenInline(child->childrenInline()); 641 parent->setChildrenInline(child->childrenInline());
642 642
643 parent->children()->removeChildNode(parent, child, child->hasLayer()); 643 parent->children()->removeChildNode(parent, child, child->hasLayer());
644 child->destroy(); 644 child->destroy();
645 } 645 }
646 646
647 void LayoutBlock::removeChild(LayoutObject* oldChild)
648 {
649 // No need to waste time in merging or removing empty anonymous blocks.
650 // We can just bail out if our document is getting destroyed.
651 if (documentBeingDestroyed()) {
652 LayoutBox::removeChild(oldChild);
653 return;
654 }
655
656 // If this child is a block, and if our previous and next siblings are
657 // both anonymous blocks with inline content, then we can go ahead and
658 // fold the inline content back together.
659 LayoutObject* prev = oldChild->previousSibling();
660 LayoutObject* next = oldChild->nextSibling();
661 bool mergedAnonymousBlocks = false;
662 if (prev && next && !oldChild->isInline() && !oldChild->virtualContinuation( ) && prev->isLayoutBlockFlow() && next->isLayoutBlockFlow()) {
663 if (toLayoutBlockFlow(prev)->mergeSiblingContiguousAnonymousBlock(toLayo utBlockFlow(next))) {
664 mergedAnonymousBlocks = true;
665 next = nullptr;
666 }
667 }
668
669 LayoutBox::removeChild(oldChild);
670
671 LayoutObject* child = prev ? prev : next;
672 if (mergedAnonymousBlocks && child && !child->previousSibling() && !child->n extSibling()) {
673 // The removal has knocked us down to containing only a single anonymous
674 // box. We can go ahead and pull the content right back up into our
675 // box.
676 collapseAnonymousBlockChild(this, toLayoutBlock(child));
677 }
678 }
679
680 void LayoutBlock::startDelayUpdateScrollInfo() 647 void LayoutBlock::startDelayUpdateScrollInfo()
681 { 648 {
682 if (gDelayUpdateScrollInfo == 0) { 649 if (gDelayUpdateScrollInfo == 0) {
683 ASSERT(!gDelayedUpdateScrollInfoSet); 650 ASSERT(!gDelayedUpdateScrollInfoSet);
684 gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet; 651 gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet;
685 } 652 }
686 ASSERT(gDelayedUpdateScrollInfoSet); 653 ASSERT(gDelayedUpdateScrollInfoSet);
687 ++gDelayUpdateScrollInfo; 654 ++gDelayUpdateScrollInfo;
688 } 655 }
689 656
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 2210 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
2244 LayoutBox* currBox = *it; 2211 LayoutBox* currBox = *it;
2245 ASSERT(!currBox->needsLayout()); 2212 ASSERT(!currBox->needsLayout());
2246 } 2213 }
2247 } 2214 }
2248 } 2215 }
2249 2216
2250 #endif 2217 #endif
2251 2218
2252 } // namespace blink 2219 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698