Chromium Code Reviews| 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 4e72a4839fee9556a87fcac4d55a97dd80e31c06..f08c5a57aac9b0b9017c5b5b5cb9329b566fbae3 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&); |
| - |
| void updateAutoRepeatTracksAndSetDirtyIfNeeded(SizingOperation); |
| size_t computeAutoRepeatTracksCount(GridTrackSizingDirection, |
| SizingOperation) const; |
| @@ -347,8 +344,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>> GridAsVector; |
|
Manuel Rego
2016/11/22 10:07:17
Or GridAsMatrix?
svillar
2016/11/22 10:15:18
If you don't feel strongly about it I'd prefer to
Manuel Rego
2016/11/22 10:38:01
I'd prefer to change it if possible.
|
| + 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(); |
|
Manuel Rego
2016/11/22 10:07:17
Nit: Why this is not defined here?
It seems stran
svillar
2016/11/22 10:15:18
I don't think it's strange. Don't know if this is
Manuel Rego
2016/11/22 10:38:01
It's strange to me compared to shrinkToFit() for e
|
| + |
| + private: |
| + friend class GridIterator; |
| + GridAsVector m_grid; |
|
Manuel Rego
2016/11/22 10:07:17
Nit: I think it's kind of confusing to have 2 "m_g
svillar
2016/11/22 10:15:18
I agree but it's a private method, so there should
Manuel Rego
2016/11/22 10:38:01
I know but still, when you see the LayoutGrid code
|
| + }; |
| + Grid m_grid; |
| + |
| bool m_gridIsDirty; |
| Vector<LayoutUnit> m_rowPositions; |
| Vector<LayoutUnit> m_columnPositions; |