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

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: 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
Index: Source/core/rendering/RenderGrid.h
diff --git a/Source/core/rendering/RenderGrid.h b/Source/core/rendering/RenderGrid.h
index eddf270b80733bba6a2d0c94c3cf6f3eeb0b34c2..d0493c4f02d6406ad83e80176614072886b5fdfc 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,19 +125,20 @@ private:
virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL;
+ bool gridIsDirty() const { return m_grid.isEmpty() || m_grid[0].isEmpty(); }
+
#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();
}
@@ -137,6 +147,21 @@ private:
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

Powered by Google App Engine
This is Rietveld 408576698