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

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

Issue 1144203009: Strengthen the LayoutGrid dirtiness asserts. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/core/layout/LayoutGrid.h ('k') | Source/core/paint/GridPainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutGrid.cpp
diff --git a/Source/core/layout/LayoutGrid.cpp b/Source/core/layout/LayoutGrid.cpp
index a0d7ab63dac0d07a1878c0398bd05c13002dd313..d59367b5dadb3ef8ede2ff4d6dace5bb24b4fc47 100644
--- a/Source/core/layout/LayoutGrid.cpp
+++ b/Source/core/layout/LayoutGrid.cpp
@@ -38,6 +38,8 @@ namespace blink {
static const int infinity = -1;
+class GridItemWithSpan;
svillar 2015/06/03 09:27:33 Why this?
esprehn 2015/06/03 16:39:11 That class doesn't appear to be used or defined ou
+
class GridTrack {
public:
GridTrack()
@@ -264,24 +266,16 @@ void LayoutGrid::addChild(LayoutObject* newChild, LayoutObject* beforeChild)
{
LayoutBlock::addChild(newChild, beforeChild);
- if (gridIsDirty())
- return;
-
// The grid needs to be recomputed as it might contain auto-placed items that will change their position.
dirtyGrid();
- return;
}
void LayoutGrid::removeChild(LayoutObject* child)
{
LayoutBlock::removeChild(child);
- if (gridIsDirty())
- return;
-
// The grid needs to be recomputed as it might contain auto-placed items that will change their position.
dirtyGrid();
- return;
}
void LayoutGrid::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
@@ -925,15 +919,14 @@ void LayoutGrid::insertItemIntoGrid(LayoutBox& child, const GridCoordinate& coor
void LayoutGrid::placeItemsOnGrid()
{
- if (!gridIsDirty())
+ if (!m_gridIsDirty)
return;
ASSERT(m_gridItemCoordinate.isEmpty());
populateExplicitGridAndOrderIterator();
- // We clear the dirty bit here as the grid sizes have been updated, this means
- // that we can safely call gridRowCount() / gridColumnCount().
+ // We clear the dirty bit here as the grid sizes have been updated.
m_gridIsDirty = false;
Vector<LayoutBox*> autoMajorAxisAutoGridItems;
@@ -1122,6 +1115,9 @@ GridTrackSizingDirection LayoutGrid::autoPlacementMinorAxisDirection() const
void LayoutGrid::dirtyGrid()
{
+ if (m_gridIsDirty)
+ return;
+
// Even if this could be redundant, it could be seen as a defensive strategy against
// style changes events happening during the layout phase or even while the painting process
// is still ongoing.
@@ -1131,9 +1127,9 @@ void LayoutGrid::dirtyGrid()
m_grid.resize(0);
m_gridItemCoordinate.clear();
- m_gridIsDirty = true;
m_gridItemsOverflowingGridArea.resize(0);
m_gridItemsIndexesMap.clear();
+ m_gridIsDirty = true;
}
void LayoutGrid::layoutGridItems()
« no previous file with comments | « Source/core/layout/LayoutGrid.h ('k') | Source/core/paint/GridPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698