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

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

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 | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | Source/core/layout/LayoutGrid.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutGrid.h
diff --git a/Source/core/layout/LayoutGrid.h b/Source/core/layout/LayoutGrid.h
index e26f163760f510b3d58ffb310747f1ac82081d33..d021eb7eedcf7a492df07c2a247af7dfed284250 100644
--- a/Source/core/layout/LayoutGrid.h
+++ b/Source/core/layout/LayoutGrid.h
@@ -35,11 +35,10 @@ namespace blink {
struct GridCoordinate;
struct GridSpan;
class GridTrack;
-class GridItemWithSpan;
class LayoutGrid final : public LayoutBlock {
public:
- LayoutGrid(Element*);
+ explicit LayoutGrid(Element*);
virtual ~LayoutGrid();
virtual const char* name() const override { return "LayoutGrid"; }
@@ -50,18 +49,40 @@ public:
void dirtyGrid();
- const Vector<LayoutUnit>& columnPositions() const { return m_columnPositions; }
- const Vector<LayoutUnit>& rowPositions() const { return m_rowPositions; }
+ const Vector<LayoutUnit>& columnPositions() const
+ {
+ ASSERT(!m_gridIsDirty);
+ return m_columnPositions;
+ }
+
+ const Vector<LayoutUnit>& rowPositions() const
+ {
+ ASSERT(!m_gridIsDirty);
+ return m_rowPositions;
+ }
typedef Vector<LayoutBox*, 1> GridCell;
- const GridCell& gridCell(int row, int column) { return m_grid[row][column]; }
- const Vector<LayoutBox*>& itemsOverflowingGridArea() { return m_gridItemsOverflowingGridArea; }
- int paintIndexForGridItem(const LayoutBox* layoutBox) { return m_gridItemsIndexesMap.get(layoutBox); }
+ const GridCell& gridCell(int row, int column)
+ {
+ ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty);
+ return m_grid[row][column];
+ }
- bool gridIsDirty() const { return m_gridIsDirty; }
+ const Vector<LayoutBox*>& itemsOverflowingGridArea()
+ {
+ ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty);
+ return m_gridItemsOverflowingGridArea;
+ }
+
+ int paintIndexForGridItem(const LayoutBox* layoutBox)
+ {
+ ASSERT_WITH_SECURITY_IMPLICATION(!m_gridIsDirty);
+ return m_gridItemsIndexesMap.get(layoutBox);
+ }
- typedef void (GridTrack::* AccumulatorGrowFunction)(LayoutUnit);
private:
+ typedef void (GridTrack::* AccumulatorGrowFunction)(LayoutUnit);
+
virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutGrid || LayoutBlock::isOfType(type); }
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
virtual void computePreferredLogicalWidths() override;
@@ -151,12 +172,12 @@ private:
size_t gridColumnCount() const
{
- ASSERT(!gridIsDirty());
+ ASSERT(!m_gridIsDirty);
return m_grid[0].size();
}
size_t gridRowCount() const
{
- ASSERT(!gridIsDirty());
+ ASSERT(!m_gridIsDirty);
return m_grid.size();
}
« no previous file with comments | « no previous file | Source/core/layout/LayoutGrid.cpp » ('j') | Source/core/layout/LayoutGrid.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698