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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutGrid.h

Issue 2522503002: [css-grid] Convert GridRepresentation into an actual class (Closed)
Patch Set: Pach for landing. Rebased Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutGrid.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.h b/third_party/WebKit/Source/core/layout/LayoutGrid.h
index 1de377f7b7d606a1c90c088882305a3155ed28d7..71387618b201268b6b8d0901a4b7a5557a807fc0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.h
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.h
@@ -75,7 +75,7 @@ class LayoutGrid final : public LayoutBlock {
typedef Vector<LayoutBox*, 1> GridCell;
const GridCell& gridCell(int row, int column) const {
SECURITY_DCHECK(!m_gridIsDirty);
- return m_grid[row][column];
+ return m_grid.cell(row, column);
}
const Vector<LayoutBox*>& itemsOverflowingGridArea() const {
@@ -139,9 +139,6 @@ class LayoutGrid final : public LayoutBlock {
void resolveContentBasedTrackSizingFunctions(GridTrackSizingDirection,
GridSizingData&) const;
- void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize);
- void insertItemIntoGrid(LayoutBox&, const GridArea&);
-
size_t computeAutoRepeatTracksCount(GridTrackSizingDirection,
SizingOperation) const;
@@ -346,8 +343,32 @@ class LayoutGrid final : public LayoutBlock {
size_t numTracks(GridTrackSizingDirection) const;
- typedef Vector<Vector<GridCell>> GridRepresentation;
- GridRepresentation m_grid;
+ // TODO(svillar): move into this class once GridIterator is added.
+ typedef Vector<Vector<GridCell>> GridAsMatrix;
+ class Grid final {
+ public:
+ Grid() {}
+
+ size_t numColumns() const { return m_grid.size() ? m_grid[0].size() : 0; }
+ size_t numRows() const { return m_grid.size(); }
+
+ void ensureGridSize(size_t maximumRowSize, size_t maximumColumnSize);
+ void insert(LayoutBox&, const GridArea&);
+
+ const GridCell& cell(size_t row, size_t column) const {
+ return m_grid[row][column];
+ }
+
+ void shrinkToFit() { m_grid.shrinkToFit(); }
+
+ void clear();
+
+ private:
+ friend class GridIterator;
+ GridAsMatrix m_grid;
+ };
+ Grid m_grid;
+
bool m_gridIsDirty;
Vector<LayoutUnit> m_rowPositions;
Vector<LayoutUnit> m_columnPositions;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698