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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlock.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 7c5a3ec0fa7ad15135b60b2e62a3698710bb155f..dede7ace30f3fe8dc89e5398eee9dbbfb61b9638 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -1224,8 +1224,18 @@ void LayoutBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou
positionedObject->layoutIfNeeded();
+ LayoutObject* parent = positionedObject->parent();
+ 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
+ if (parent->isFlexibleBox() && toLayoutFlexibleBox(parent)->setStaticPositionForPositionedLayout(*positionedObject)) {
+ // The static position of an abspos child of a flexbox depends on its size (for example,
+ // they can be centered). So we may have to reposition the item after layout.
+ // TODO(cbiesinger): We could probably avoid a layout here and just reposition?
+ positionedObject->forceChildLayout();
+ relaidOut = true;
+ }
+
// Lay out again if our estimate was wrong.
- if (needsBlockDirectionLocationSetBeforeLayout && logicalTopEstimate != logicalTopForChild(*positionedObject))
+ if (!relaidOut && needsBlockDirectionLocationSetBeforeLayout && logicalTopEstimate != logicalTopForChild(*positionedObject))
positionedObject->forceChildLayout();
}
}

Powered by Google App Engine
This is Rietveld 408576698