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

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

Issue 1495033002: Clear intruding floats when moving child to inline parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@558405-5
Patch Set: Updated Created 5 years 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } 1003 }
1004 1004
1005 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, L ayoutObject* child, LayoutObject* beforeChild, bool fullRemoveInsert) 1005 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, L ayoutObject* child, LayoutObject* beforeChild, bool fullRemoveInsert)
1006 { 1006 {
1007 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the 1007 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the
1008 // positioned layoutObject maps don't become stale. It would be too slow to do the map lookup on each call. 1008 // positioned layoutObject maps don't become stale. It would be too slow to do the map lookup on each call.
1009 ASSERT(!fullRemoveInsert || !isLayoutBlock() || !toLayoutBlock(this)->hasPos itionedObjects()); 1009 ASSERT(!fullRemoveInsert || !isLayoutBlock() || !toLayoutBlock(this)->hasPos itionedObjects());
1010 1010
1011 ASSERT(this == child->parent()); 1011 ASSERT(this == child->parent());
1012 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 1012 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
1013
1014 // If a child is moving from a block-flow to an inline-flow parent then any floats currently intruding into
1015 // the child can no longer do so. This can happen if a block becomes floatin g or out-of-flow and is moved
1016 // to an anonymous block. Remove all floats from their float-lists immediate ly as markAllDescendantsWithFloatsForLayout
1017 // won't attempt to remove floats from parents that have inline-flow if we t ry later.
1018 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && !chi ld->childrenInline() && !childrenInline()) {
1019 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants();
1020 ASSERT(!toLayoutBlockFlow(child)->containsFloats());
1021 }
1022
1013 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) { 1023 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || toBoxModelObje ct->isLayoutInline())) {
1014 // Takes care of adding the new child correctly if toBlock and fromBlock 1024 // Takes care of adding the new child correctly if toBlock and fromBlock
1015 // have different kind of children (block vs inline). 1025 // have different kind of children (block vs inline).
1016 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild); 1026 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, chil d), beforeChild);
1017 } else { 1027 } else {
1018 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert); 1028 toBoxModelObject->virtualChildren()->insertChildNode(toBoxModelObject, v irtualChildren()->removeChildNode(this, child, fullRemoveInsert), beforeChild, f ullRemoveInsert);
1019 } 1029 }
1020 } 1030 }
1021 1031
1022 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert) 1032 void LayoutBoxModelObject::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject , LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, b ool fullRemoveInsert)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (rootElementStyle->hasBackground()) 1067 if (rootElementStyle->hasBackground())
1058 return false; 1068 return false;
1059 1069
1060 if (node() != document().firstBodyElement()) 1070 if (node() != document().firstBodyElement())
1061 return false; 1071 return false;
1062 1072
1063 return true; 1073 return true;
1064 } 1074 }
1065 1075
1066 } // namespace blink 1076 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/float/clear-intruding-floats-when-moving-to-inline-parent-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698