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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.cpp

Issue 2748983003: [css-grid] Fix crash removing positioned grid item (Closed)
Patch Set: Created 3 years, 9 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/LayoutGrid.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index db381a810e2202fa81cdfe15b9fbeeef4d2ef18e..c9cc84b668b8efaaecd62ddec9284af6098e7748 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -71,17 +71,21 @@ LayoutGrid* LayoutGrid::createAnonymous(Document* document) {
void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) {
LayoutBlock::addChild(newChild, beforeChild);
- // The grid needs to be recomputed as it might contain auto-placed items that
- // will change their position.
- dirtyGrid();
+ if (!newChild->isOutOfFlowPositioned()) {
jfernandez 2017/03/15 09:26:36 I think it'd be useful to add comment explaining w
Manuel Rego 2017/03/15 10:59:26 Done.
+ // The grid needs to be recomputed as it might contain auto-placed items
+ // that will change their position.
+ dirtyGrid();
+ }
svillar 2017/03/15 10:03:54 Better to early return if (newChild->isOutOfFlowP
Manuel Rego 2017/03/15 10:59:26 Acknowledged.
}
void LayoutGrid::removeChild(LayoutObject* child) {
LayoutBlock::removeChild(child);
- // The grid needs to be recomputed as it might contain auto-placed items that
- // will change their position.
- dirtyGrid();
+ if (!child->isOutOfFlowPositioned()) {
+ // The grid needs to be recomputed as it might contain auto-placed items
+ // that will change their position.
+ dirtyGrid();
+ }
svillar 2017/03/15 10:03:54 Ditto.
Manuel Rego 2017/03/15 10:59:26 Acknowledged.
}
void LayoutGrid::styleDidChange(StyleDifference diff,

Powered by Google App Engine
This is Rietveld 408576698