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

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

Issue 2748983003: [css-grid] Fix crash removing positioned grid item (Closed)
Patch Set: Early return, improved test and more comments 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 db381a810e2202fa81cdfe15b9fbeeef4d2ef18e..9cef256ddbad31b5c92ea199f6aa4c92f00ff4b2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -71,6 +71,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();
@@ -79,6 +85,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