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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "core/rendering/OrderIterator.h" | 29 #include "core/rendering/OrderIterator.h" |
30 #include "core/rendering/RenderBlock.h" | 30 #include "core/rendering/RenderBlock.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 struct GridCoordinate; | 34 struct GridCoordinate; |
35 struct GridSpan; | 35 struct GridSpan; |
36 class GridTrack; | 36 class GridTrack; |
37 | 37 |
38 enum GridTrackSizingDirection { | 38 typedef HashMap<String, Vector<size_t> > NamedGridLinesMap; |
39 ForColumns, | |
40 ForRows | |
41 }; | |
42 | 39 |
43 class RenderGrid FINAL : public RenderBlock { | 40 class RenderGrid FINAL : public RenderBlock { |
44 public: | 41 public: |
45 RenderGrid(Element*); | 42 RenderGrid(Element*); |
46 virtual ~RenderGrid(); | 43 virtual ~RenderGrid(); |
47 | 44 |
48 virtual const char* renderName() const OVERRIDE; | 45 virtual const char* renderName() const OVERRIDE; |
49 | 46 |
50 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; | 47 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; |
51 | 48 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 { | 143 { |
147 ASSERT(!gridIsDirty()); | 144 ASSERT(!gridIsDirty()); |
148 return m_grid[0].size(); | 145 return m_grid[0].size(); |
149 } | 146 } |
150 size_t gridRowCount() const | 147 size_t gridRowCount() const |
151 { | 148 { |
152 ASSERT(!gridIsDirty()); | 149 ASSERT(!gridIsDirty()); |
153 return m_grid.size(); | 150 return m_grid.size(); |
154 } | 151 } |
155 | 152 |
| 153 const NamedGridLinesMap& gridLinesForSide(GridPositionSide side) const { ret
urn (side == ColumnStartSide || side == ColumnEndSide) ? m_namedGridColumnLines
: m_namedGridRowLines; } |
| 154 void createGridLineNamesMapsForDirection(GridTrackSizingDirection); |
| 155 |
156 typedef Vector<RenderBox*, 1> GridCell; | 156 typedef Vector<RenderBox*, 1> GridCell; |
157 typedef Vector<Vector<GridCell> > GridRepresentation; | 157 typedef Vector<Vector<GridCell> > GridRepresentation; |
158 GridRepresentation m_grid; | 158 GridRepresentation m_grid; |
159 bool m_gridIsDirty; | 159 bool m_gridIsDirty; |
160 Vector<LayoutUnit> m_rowPositions; | 160 Vector<LayoutUnit> m_rowPositions; |
161 Vector<LayoutUnit> m_columnPositions; | 161 Vector<LayoutUnit> m_columnPositions; |
162 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; | 162 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; |
163 OrderIterator m_orderIterator; | 163 OrderIterator m_orderIterator; |
164 Vector<RenderBox*> m_gridItemsOverflowingGridArea; | 164 Vector<RenderBox*> m_gridItemsOverflowingGridArea; |
165 | 165 |
| 166 NamedGridLinesMap m_namedGridColumnLines; |
| 167 NamedGridLinesMap m_namedGridRowLines; |
| 168 |
166 friend class GridCoordinateSorter; | 169 friend class GridCoordinateSorter; |
167 }; | 170 }; |
168 | 171 |
169 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); | 172 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); |
170 | 173 |
171 } // namespace WebCore | 174 } // namespace WebCore |
172 | 175 |
173 #endif // RenderGrid_h | 176 #endif // RenderGrid_h |
OLD | NEW |