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

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: 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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 // If a child is moving from a block-flow to an inline-flow parent then any floats currently intruding into 1002 // If a child is moving from a block-flow to an inline-flow parent then any floats currently intruding into
1003 // the child can no longer do so. This can happen if a block becomes floatin g or out-of-flow and is moved 1003 // the child can no longer do so. This can happen if a block becomes floatin g or out-of-flow and is moved
1004 // to an anonymous block. Remove all floats from their float-lists immediate ly as markAllDescendantsWithFloatsForLayout 1004 // to an anonymous block. Remove all floats from their float-lists immediate ly as markAllDescendantsWithFloatsForLayout
1005 // won't attempt to remove floats from parents that have inline-flow if we t ry later. 1005 // won't attempt to remove floats from parents that have inline-flow if we t ry later.
1006 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && !chi ldrenInline()) { 1006 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && !chi ldrenInline()) {
1007 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants(); 1007 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants();
1008 ASSERT(!toLayoutBlockFlow(child)->containsFloats()); 1008 ASSERT(!toLayoutBlockFlow(child)->containsFloats());
1009 } 1009 }
1010 1010
1011 if (fullRemoveInsert && isLayoutBlock() && child->isBox()) 1011 if (fullRemoveInsert && isLayoutBlock() && child->isBox())
1012 LayoutBlock::removePercentHeightDescendantIfNeeded(toLayoutBox(child)); 1012 toLayoutBox(child)->removeFromPercentHeightContainer();
1013 1013
1014 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) { 1014 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) {
1015 // Takes care of adding the new child correctly if toBlock and fromBlock 1015 // Takes care of adding the new child correctly if toBlock and fromBlock
1016 // have different kind of children (block vs inline). 1016 // have different kind of children (block vs inline).
1017 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild); 1017 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild);
1018 } else { 1018 } else {
1019 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert); 1019 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert);
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert) 1023 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert)
1024 { 1024 {
1025 // This condition is rarely hit since this function is usually called on 1025 // This condition is rarely hit since this function is usually called on
1026 // anonymous blocks which can no longer carry positioned objects (see r12076 1) 1026 // anonymous blocks which can no longer carry positioned objects (see r12076 1)
1027 // or when fullRemoveInsert is false. 1027 // or when fullRemoveInsert is false.
1028 if (fullRemoveInsert && isLayoutBlock()) { 1028 if (fullRemoveInsert && isLayoutBlock()) {
1029 LayoutBlock* block = toLayoutBlock(this); 1029 LayoutBlock* block = toLayoutBlock(this);
1030 block->removePositionedObjects(nullptr); 1030 block->removePositionedObjects(nullptr);
1031 LayoutBlock::removePercentHeightDescendantIfNeeded(block); 1031 block->removeFromPercentHeightContainer();
1032 if (block->isLayoutBlockFlow()) 1032 if (block->isLayoutBlockFlow())
1033 toLayoutBlockFlow(block)->removeFloatingObjects(); 1033 toLayoutBlockFlow(block)->removeFloatingObjects();
1034 } 1034 }
1035 1035
1036 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 1036 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
1037 for (LayoutObject* child = startChild; child && child != endChild; ) { 1037 for (LayoutObject* child = startChild; child && child != endChild; ) {
1038 // Save our next sibling as moveChildTo will clear it. 1038 // Save our next sibling as moveChildTo will clear it.
1039 LayoutObject* nextSibling = child->nextSibling(); 1039 LayoutObject* nextSibling = child->nextSibling();
1040 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 1040 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
1041 child = nextSibling; 1041 child = nextSibling;
(...skipping 17 matching lines...) Expand all
1059 if (rootElementStyle->hasBackground()) 1059 if (rootElementStyle->hasBackground())
1060 return false; 1060 return false;
1061 1061
1062 if (node() != document().firstBodyElement()) 1062 if (node() != document().firstBodyElement())
1063 return false; 1063 return false;
1064 1064
1065 return true; 1065 return true;
1066 } 1066 }
1067 1067
1068 } // namespace blink 1068 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698