OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GridResolvedPosition_h | 5 #ifndef GridResolvedPosition_h |
6 #define GridResolvedPosition_h | 6 #define GridResolvedPosition_h |
7 | 7 |
8 #include "core/style/GridPosition.h" | 8 #include "core/style/GridPosition.h" |
| 9 #include "wtf/Allocator.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 struct GridSpan; | 13 struct GridSpan; |
13 class LayoutBox; | 14 class LayoutBox; |
14 class ComputedStyle; | 15 class ComputedStyle; |
15 | 16 |
16 enum GridPositionSide { | 17 enum GridPositionSide { |
17 ColumnStartSide, | 18 ColumnStartSide, |
18 ColumnEndSide, | 19 ColumnEndSide, |
19 RowStartSide, | 20 RowStartSide, |
20 RowEndSide | 21 RowEndSide |
21 }; | 22 }; |
22 | 23 |
23 enum GridTrackSizingDirection { | 24 enum GridTrackSizingDirection { |
24 ForColumns, | 25 ForColumns, |
25 ForRows | 26 ForRows |
26 }; | 27 }; |
27 | 28 |
28 // This class represents an index into one of the dimensions of the grid array. | 29 // This class represents an index into one of the dimensions of the grid array. |
29 // Wraps a size_t integer just for the purpose of knowing what we manipulate in
the grid code. | 30 // Wraps a size_t integer just for the purpose of knowing what we manipulate in
the grid code. |
30 class GridResolvedPosition { | 31 class GridResolvedPosition { |
| 32 DISALLOW_ALLOCATION(); |
31 public: | 33 public: |
32 static GridResolvedPosition adjustGridPositionForAfterEndSide(size_t resolve
dPosition) | 34 static GridResolvedPosition adjustGridPositionForAfterEndSide(size_t resolve
dPosition) |
33 { | 35 { |
34 return resolvedPosition ? GridResolvedPosition(resolvedPosition - 1) : G
ridResolvedPosition(0); | 36 return resolvedPosition ? GridResolvedPosition(resolvedPosition - 1) : G
ridResolvedPosition(0); |
35 } | 37 } |
36 | 38 |
37 static GridResolvedPosition adjustGridPositionForSide(size_t resolvedPositio
n, GridPositionSide side) | 39 static GridResolvedPosition adjustGridPositionForSide(size_t resolvedPositio
n, GridPositionSide side) |
38 { | 40 { |
39 // An item finishing on the N-th line belongs to the N-1-th cell. | 41 // An item finishing on the N-th line belongs to the N-1-th cell. |
40 if (side == ColumnEndSide || side == RowEndSide) | 42 if (side == ColumnEndSide || side == RowEndSide) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 private: | 123 private: |
122 | 124 |
123 static size_t explicitGridSizeForSide(const ComputedStyle&, GridPositionSide
); | 125 static size_t explicitGridSizeForSide(const ComputedStyle&, GridPositionSide
); |
124 | 126 |
125 size_t m_integerPosition; | 127 size_t m_integerPosition; |
126 }; | 128 }; |
127 | 129 |
128 } // namespace blink | 130 } // namespace blink |
129 | 131 |
130 #endif // GridResolvedPosition_h | 132 #endif // GridResolvedPosition_h |
OLD | NEW |