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

Unified Diff: Source/core/rendering/RenderGrid.cpp

Issue 358673003: [CSS Grid Layout] Avoid inserting grid items twice in the grid (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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: Source/core/rendering/RenderGrid.cpp
diff --git a/Source/core/rendering/RenderGrid.cpp b/Source/core/rendering/RenderGrid.cpp
index a1de68202177f4dafa8c7e86d0569ead6c56f4df..76756b0a11f9ffd3ec5f9cafea605d99064a92e1 100644
--- a/Source/core/rendering/RenderGrid.cpp
+++ b/Source/core/rendering/RenderGrid.cpp
@@ -207,6 +207,15 @@ void RenderGrid::addChild(RenderObject* newChild, RenderObject* beforeChild)
if (gridIsDirty())
return;
+ // If the new requested beforeChild is not one of our children is because it's wrapped by an anonymous container. In
+ // those cases addChild will be called twice for the newChild, one with the initial beforeChild and another one with
+ // its parent (the anonymous block container). See RenderBlock::addChildIgnoringAnonymousColumnBlocks()
+ if (beforeChild && beforeChild->parent() != this) {
+ ASSERT(beforeChild->parent()->isAnonymous());
+ dirtyGrid();
Julien - ping for review 2014/06/25 21:25:08 Do we really need to invalidate the grid in this c
svillar 2014/06/26 09:45:53 Good point, should be safe to just return indeed.
+ return;
+ }
+
if (!newChild->isBox()) {
dirtyGrid();
return;

Powered by Google App Engine
This is Rietveld 408576698