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(); |