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

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

Issue 1544423002: Improve positioned/percentHeight descendant/container tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: virtual destructor Created 4 years, 11 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 // If a child is moving from a block-flow to an inline-flow parent then any floats currently intruding into 1007 // If a child is moving from a block-flow to an inline-flow parent then any floats currently intruding into
1008 // the child can no longer do so. This can happen if a block becomes floatin g or out-of-flow and is moved 1008 // the child can no longer do so. This can happen if a block becomes floatin g or out-of-flow and is moved
1009 // to an anonymous block. Remove all floats from their float-lists immediate ly as markAllDescendantsWithFloatsForLayout 1009 // to an anonymous block. Remove all floats from their float-lists immediate ly as markAllDescendantsWithFloatsForLayout
1010 // won't attempt to remove floats from parents that have inline-flow if we t ry later. 1010 // won't attempt to remove floats from parents that have inline-flow if we t ry later.
1011 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && !chi ldrenInline()) { 1011 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && !chi ldrenInline()) {
1012 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants(); 1012 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants();
1013 ASSERT(!toLayoutBlockFlow(child)->containsFloats()); 1013 ASSERT(!toLayoutBlockFlow(child)->containsFloats());
1014 } 1014 }
1015 1015
1016 if (fullRemoveInsert && isLayoutBlock() && child->isBox()) 1016 if (fullRemoveInsert && isLayoutBlock() && child->isBox())
1017 LayoutBlock::removePercentHeightDescendantIfNeeded(toLayoutBox(child)); 1017 toLayoutBox(child)->removeFromPercentHeightContainer();
1018 1018
1019 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) { 1019 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) {
1020 // Takes care of adding the new child correctly if toBlock and fromBlock 1020 // Takes care of adding the new child correctly if toBlock and fromBlock
1021 // have different kind of children (block vs inline). 1021 // have different kind of children (block vs inline).
1022 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild); 1022 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild);
1023 } else { 1023 } else {
1024 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert); 1024 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert);
1025 } 1025 }
1026 } 1026 }
1027 1027
1028 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert) 1028 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert)
1029 { 1029 {
1030 // This condition is rarely hit since this function is usually called on 1030 // This condition is rarely hit since this function is usually called on
1031 // anonymous blocks which can no longer carry positioned objects (see r12076 1) 1031 // anonymous blocks which can no longer carry positioned objects (see r12076 1)
1032 // or when fullRemoveInsert is false. 1032 // or when fullRemoveInsert is false.
1033 if (fullRemoveInsert && isLayoutBlock()) { 1033 if (fullRemoveInsert && isLayoutBlock()) {
1034 LayoutBlock* block = toLayoutBlock(this); 1034 LayoutBlock* block = toLayoutBlock(this);
1035 block->removePositionedObjects(nullptr); 1035 block->removePositionedObjects(nullptr);
1036 LayoutBlock::removePercentHeightDescendantIfNeeded(block); 1036 block->removeFromPercentHeightContainer();
1037 if (block->isLayoutBlockFlow()) 1037 if (block->isLayoutBlockFlow())
1038 toLayoutBlockFlow(block)->removeFloatingObjects(); 1038 toLayoutBlockFlow(block)->removeFloatingObjects();
1039 } 1039 }
1040 1040
1041 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 1041 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
1042 for (LayoutObject* child = startChild; child && child != endChild; ) { 1042 for (LayoutObject* child = startChild; child && child != endChild; ) {
1043 // Save our next sibling as moveChildTo will clear it. 1043 // Save our next sibling as moveChildTo will clear it.
1044 LayoutObject* nextSibling = child->nextSibling(); 1044 LayoutObject* nextSibling = child->nextSibling();
1045 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 1045 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
1046 child = nextSibling; 1046 child = nextSibling;
(...skipping 17 matching lines...) Expand all
1064 if (rootElementStyle->hasBackground()) 1064 if (rootElementStyle->hasBackground())
1065 return false; 1065 return false;
1066 1066
1067 if (node() != document().firstBodyElement()) 1067 if (node() != document().firstBodyElement())
1068 return false; 1068 return false;
1069 1069
1070 return true; 1070 return true;
1071 } 1071 }
1072 1072
1073 } // namespace blink 1073 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698