OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; | 46 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; |
47 | 47 |
48 virtual bool canCollapseAnonymousBlockChild() const OVERRIDE { return false;
} | 48 virtual bool canCollapseAnonymousBlockChild() const OVERRIDE { return false;
} |
49 | 49 |
50 void dirtyGrid(); | 50 void dirtyGrid(); |
51 | 51 |
52 const Vector<LayoutUnit>& columnPositions() const { return m_columnPositions
; } | 52 const Vector<LayoutUnit>& columnPositions() const { return m_columnPositions
; } |
53 const Vector<LayoutUnit>& rowPositions() const { return m_rowPositions; } | 53 const Vector<LayoutUnit>& rowPositions() const { return m_rowPositions; } |
54 | 54 |
| 55 typedef Vector<RenderBox*, 1> GridCell; |
| 56 const GridCell& gridCell(int row, int column) { return m_grid[row][column];
} |
| 57 const Vector<RenderBox*>& itemsOverflowingGridArea() { return m_gridItemsOve
rflowingGridArea; } |
| 58 int paintIndexForGridItem(const RenderBox* renderBox) { return m_gridItemsIn
dexesMap.get(renderBox); } |
| 59 |
| 60 bool gridIsDirty() const { return m_gridIsDirty; } |
| 61 |
55 private: | 62 private: |
56 virtual bool isRenderGrid() const OVERRIDE { return true; } | 63 virtual bool isRenderGrid() const OVERRIDE { return true; } |
57 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const OVERRIDE; | 64 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layo
utUnit& maxLogicalWidth) const OVERRIDE; |
58 virtual void computePreferredLogicalWidths() OVERRIDE; | 65 virtual void computePreferredLogicalWidths() OVERRIDE; |
59 | 66 |
60 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; | 67 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; |
61 void addChildToIndexesMap(RenderBox&); | 68 void addChildToIndexesMap(RenderBox&); |
62 virtual void removeChild(RenderObject*) OVERRIDE; | 69 virtual void removeChild(RenderObject*) OVERRIDE; |
63 | 70 |
64 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; | 71 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 LayoutUnit centeredRowPositionForChild(const RenderBox&) const; | 122 LayoutUnit centeredRowPositionForChild(const RenderBox&) const; |
116 LayoutUnit rowPositionForChild(const RenderBox&) const; | 123 LayoutUnit rowPositionForChild(const RenderBox&) const; |
117 LayoutPoint findChildLogicalPosition(const RenderBox&) const; | 124 LayoutPoint findChildLogicalPosition(const RenderBox&) const; |
118 GridCoordinate cachedGridCoordinate(const RenderBox&) const; | 125 GridCoordinate cachedGridCoordinate(const RenderBox&) const; |
119 | 126 |
120 LayoutUnit gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; | 127 LayoutUnit gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; |
121 | 128 |
122 virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE; | 129 virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE; |
123 void paintChild(RenderBox*, PaintInfo&, const LayoutPoint&); | 130 void paintChild(RenderBox*, PaintInfo&, const LayoutPoint&); |
124 | 131 |
125 bool gridIsDirty() const { return m_gridIsDirty; } | |
126 | |
127 #if ENABLE(ASSERT) | 132 #if ENABLE(ASSERT) |
128 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, const Vecto
r<GridTrack>&); | 133 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, const Vecto
r<GridTrack>&); |
129 #endif | 134 #endif |
130 | 135 |
131 size_t gridItemSpan(const RenderBox&, GridTrackSizingDirection); | 136 size_t gridItemSpan(const RenderBox&, GridTrackSizingDirection); |
132 | 137 |
133 size_t gridColumnCount() const | 138 size_t gridColumnCount() const |
134 { | 139 { |
135 ASSERT(!gridIsDirty()); | 140 ASSERT(!gridIsDirty()); |
136 return m_grid[0].size(); | 141 return m_grid[0].size(); |
137 } | 142 } |
138 size_t gridRowCount() const | 143 size_t gridRowCount() const |
139 { | 144 { |
140 ASSERT(!gridIsDirty()); | 145 ASSERT(!gridIsDirty()); |
141 return m_grid.size(); | 146 return m_grid.size(); |
142 } | 147 } |
143 | 148 |
144 typedef Vector<RenderBox*, 1> GridCell; | |
145 typedef Vector<Vector<GridCell> > GridRepresentation; | 149 typedef Vector<Vector<GridCell> > GridRepresentation; |
146 GridRepresentation m_grid; | 150 GridRepresentation m_grid; |
147 bool m_gridIsDirty; | 151 bool m_gridIsDirty; |
148 Vector<LayoutUnit> m_rowPositions; | 152 Vector<LayoutUnit> m_rowPositions; |
149 Vector<LayoutUnit> m_columnPositions; | 153 Vector<LayoutUnit> m_columnPositions; |
150 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; | 154 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; |
151 OrderIterator m_orderIterator; | 155 OrderIterator m_orderIterator; |
152 Vector<RenderBox*> m_gridItemsOverflowingGridArea; | 156 Vector<RenderBox*> m_gridItemsOverflowingGridArea; |
153 HashMap<const RenderBox*, size_t> m_gridItemsIndexesMap; | 157 HashMap<const RenderBox*, size_t> m_gridItemsIndexesMap; |
154 }; | 158 }; |
155 | 159 |
156 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); | 160 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); |
157 | 161 |
158 } // namespace blink | 162 } // namespace blink |
159 | 163 |
160 #endif // RenderGrid_h | 164 #endif // RenderGrid_h |
OLD | NEW |