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

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

Issue 21205004: [CSS Grid Layout] Store m_grid across layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated change after Ojan's review Created 7 years, 5 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/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderGrid.h
diff --git a/Source/core/rendering/RenderGrid.h b/Source/core/rendering/RenderGrid.h
index eddf270b80733bba6a2d0c94c3cf6f3eeb0b34c2..0966ec30dfa7852c04b53312ddfe4615a9df86cb 100644
--- a/Source/core/rendering/RenderGrid.h
+++ b/Source/core/rendering/RenderGrid.h
@@ -54,11 +54,21 @@ public:
virtual bool avoidsFloats() const OVERRIDE { return true; }
virtual bool canCollapseAnonymousBlockChild() const OVERRIDE { return false; }
+ void dirtyGrid();
+
private:
virtual bool isRenderGrid() const OVERRIDE { return true; }
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE;
virtual void computePreferredLogicalWidths() OVERRIDE;
+ virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE;
+ virtual void removeChild(RenderObject*) OVERRIDE;
+
+ virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE;
+
+ bool explicitGridDidResize(const RenderStyle*) const;
+ bool namedGridLinesDefinitionDidChange(const RenderStyle*) const;
+
LayoutUnit computePreferredTrackWidth(const GridLength&, size_t) const;
class GridIterator;
@@ -81,7 +91,6 @@ private:
TrackSizingDirection autoPlacementMinorAxisDirection() const;
void layoutGridItems();
- void clearGrid();
typedef LayoutUnit (RenderGrid::* SizingFunction)(RenderBox*, TrackSizingDirection, Vector<GridTrack>&);
typedef LayoutUnit (GridTrack::* AccumulatorGetter)() const;
@@ -116,27 +125,44 @@ private:
virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL;
+ bool gridIsDirty() const { return m_gridIsDirty; }
+
#ifndef NDEBUG
bool tracksAreWiderThanMinTrackBreadth(TrackSizingDirection, const Vector<GridTrack>&);
- bool gridWasPopulated() const { return !m_grid.isEmpty() && !m_grid[0].isEmpty(); }
#endif
size_t gridColumnCount() const
{
- ASSERT(gridWasPopulated());
+ ASSERT(!gridIsDirty());
return m_grid[0].size();
}
size_t gridRowCount() const
{
- ASSERT(gridWasPopulated());
+ ASSERT(!gridIsDirty());
return m_grid.size();
}
Vector<Vector<Vector<RenderBox*, 1> > > m_grid;
+ bool m_gridIsDirty;
HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate;
OrderIterator m_orderIterator;
};
+inline RenderGrid* toRenderGrid(RenderObject* object)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderGrid());
+ return static_cast<RenderGrid*>(object);
+}
+
+inline const RenderGrid* toRenderGrid(const RenderObject* object)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderGrid());
+ return static_cast<const RenderGrid*>(object);
+}
+
+// Catch unneeded cast.
+void toRenderGrid(const RenderGrid*);
+
} // namespace WebCore
#endif // RenderGrid_h
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698