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

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

Issue 2758483003: [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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 554dd56f02e6a7f27964a87cb991eb8c92460a91..84c9f19e65f8ecc7f2c510b236b9d2b6cd733bb3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -76,6 +76,12 @@ LayoutGrid* LayoutGrid::createAnonymous(Document* document) {
void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) {
LayoutBlock::addChild(newChild, beforeChild);
+ // Positioned grid items do not take up space or otherwise participate in the
+ // layout of the grid, for that reason we don't need to mark the grid as dirty
+ // when they are added.
+ if (newChild->isOutOfFlowPositioned())
+ return;
+
// The grid needs to be recomputed as it might contain auto-placed items that
// will change their position.
dirtyGrid();
@@ -84,6 +90,12 @@ void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild) {
void LayoutGrid::removeChild(LayoutObject* child) {
LayoutBlock::removeChild(child);
+ // Positioned grid items do not take up space or otherwise participate in the
+ // layout of the grid, for that reason we don't need to mark the grid as dirty
+ // when they are removed.
+ if (child->isOutOfFlowPositioned())
+ return;
+
// The grid needs to be recomputed as it might contain auto-placed items that
// will change their position.
dirtyGrid();
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698