OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef GridCoordinate_h | 31 #ifndef GridArea_h |
32 #define GridCoordinate_h | 32 #define GridArea_h |
33 | 33 |
34 #include "core/style/GridPositionsResolver.h" | 34 #include "core/style/GridPositionsResolver.h" |
35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
38 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
39 #include <algorithm> | 39 #include <algorithm> |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 else | 172 else |
173 m_resolvedFinalPosition = std::max(resolvedFinalPosition, -kGridMaxT
racks + 1); | 173 m_resolvedFinalPosition = std::max(resolvedFinalPosition, -kGridMaxT
racks + 1); |
174 } | 174 } |
175 | 175 |
176 int m_resolvedInitialPosition; | 176 int m_resolvedInitialPosition; |
177 int m_resolvedFinalPosition; | 177 int m_resolvedFinalPosition; |
178 GridSpanType m_type; | 178 GridSpanType m_type; |
179 }; | 179 }; |
180 | 180 |
181 // This represents a grid area that spans in both rows' and columns' direction. | 181 // This represents a grid area that spans in both rows' and columns' direction. |
182 struct GridCoordinate { | 182 struct GridArea { |
183 USING_FAST_MALLOC(GridCoordinate); | 183 USING_FAST_MALLOC(GridArea); |
184 public: | 184 public: |
185 // HashMap requires a default constuctor. | 185 // HashMap requires a default constuctor. |
186 GridCoordinate() | 186 GridArea() |
187 : columns(GridSpan::indefiniteGridSpan()) | 187 : columns(GridSpan::indefiniteGridSpan()) |
188 , rows(GridSpan::indefiniteGridSpan()) | 188 , rows(GridSpan::indefiniteGridSpan()) |
189 { | 189 { |
190 } | 190 } |
191 | 191 |
192 GridCoordinate(const GridSpan& r, const GridSpan& c) | 192 GridArea(const GridSpan& r, const GridSpan& c) |
193 : columns(c) | 193 : columns(c) |
194 , rows(r) | 194 , rows(r) |
195 { | 195 { |
196 } | 196 } |
197 | 197 |
198 bool operator==(const GridCoordinate& o) const | 198 bool operator==(const GridArea& o) const |
199 { | 199 { |
200 return columns == o.columns && rows == o.rows; | 200 return columns == o.columns && rows == o.rows; |
201 } | 201 } |
202 | 202 |
203 bool operator!=(const GridCoordinate& o) const | 203 bool operator!=(const GridArea& o) const |
204 { | 204 { |
205 return !(*this == o); | 205 return !(*this == o); |
206 } | 206 } |
207 | 207 |
208 GridSpan columns; | 208 GridSpan columns; |
209 GridSpan rows; | 209 GridSpan rows; |
210 }; | 210 }; |
211 | 211 |
212 typedef HashMap<String, GridCoordinate> NamedGridAreaMap; | 212 typedef HashMap<String, GridArea> NamedGridAreaMap; |
213 | 213 |
214 } // namespace blink | 214 } // namespace blink |
215 | 215 |
216 #endif // GridCoordinate_h | 216 #endif // GridArea_h |
OLD | NEW |