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

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

Issue 1920453003: [css-flexbox] Implement new abspos handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better comments Created 4 years, 8 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 if (!positionedObject->needsLayout()) 1217 if (!positionedObject->needsLayout())
1218 positionedObject->markForPaginationRelayoutIfNeeded(layoutScope); 1218 positionedObject->markForPaginationRelayoutIfNeeded(layoutScope);
1219 1219
1220 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout( ) here instead of a full layout. Need 1220 // FIXME: We should be able to do a r->setNeedsPositionedMovementLayout( ) here instead of a full layout. Need
1221 // to investigate why it does not trigger the correct invalidations in t hat case. crbug.com/350756 1221 // to investigate why it does not trigger the correct invalidations in t hat case. crbug.com/350756
1222 if (info == ForcedLayoutAfterContainingBlockMoved) 1222 if (info == ForcedLayoutAfterContainingBlockMoved)
1223 positionedObject->setNeedsLayout(LayoutInvalidationReason::AncestorM oved, MarkOnlyThis); 1223 positionedObject->setNeedsLayout(LayoutInvalidationReason::AncestorM oved, MarkOnlyThis);
1224 1224
1225 positionedObject->layoutIfNeeded(); 1225 positionedObject->layoutIfNeeded();
1226 1226
1227 LayoutObject* parent = positionedObject->parent();
1228 bool relaidOut = false;
eae 2016/04/25 02:37:28 How about needsLayout or layoutChanged instead?
cbiesinger 2016/04/26 18:21:56 Done, though I'm not certain I like this one eithe
1229 if (parent->isFlexibleBox() && toLayoutFlexibleBox(parent)->setStaticPos itionForPositionedLayout(*positionedObject)) {
1230 // The static position of an abspos child of a flexbox depends on it s size (for example,
1231 // they can be centered). So we may have to reposition the item afte r layout.
1232 // TODO(cbiesinger): We could probably avoid a layout here and just reposition?
1233 positionedObject->forceChildLayout();
1234 relaidOut = true;
1235 }
1236
1227 // Lay out again if our estimate was wrong. 1237 // Lay out again if our estimate was wrong.
1228 if (needsBlockDirectionLocationSetBeforeLayout && logicalTopEstimate != logicalTopForChild(*positionedObject)) 1238 if (!relaidOut && needsBlockDirectionLocationSetBeforeLayout && logicalT opEstimate != logicalTopForChild(*positionedObject))
1229 positionedObject->forceChildLayout(); 1239 positionedObject->forceChildLayout();
1230 } 1240 }
1231 } 1241 }
1232 1242
1233 void LayoutBlock::markPositionedObjectsForLayout() 1243 void LayoutBlock::markPositionedObjectsForLayout()
1234 { 1244 {
1235 if (TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects() ) { 1245 if (TrackedLayoutBoxListHashSet* positionedDescendants = positionedObjects() ) {
1236 for (auto* descendant : *positionedDescendants) 1246 for (auto* descendant : *positionedDescendants)
1237 descendant->setChildNeedsLayout(); 1247 descendant->setChildNeedsLayout();
1238 } 1248 }
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2842 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2833 { 2843 {
2834 showLayoutObject(); 2844 showLayoutObject();
2835 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2845 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2836 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2846 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2837 } 2847 }
2838 2848
2839 #endif 2849 #endif
2840 2850
2841 } // namespace blink 2851 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698