OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef StyleAlignmentData_h | |
6 #define StyleAlignmentData_h | |
7 | |
8 #include "core/style/ComputedStyleConstants.h" | |
9 | |
10 namespace blink { | |
11 | |
12 class StyleAlignmentData { | |
13 public: | |
14 // Style data for Self-Aligment and Default-Alignment properties: align-{sel f, items}, justify-{self, items}. | |
15 // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ] | |
16 StyleAlignmentData(ItemPosition, OverflowAlignment = OverflowAlignmentDefaul t, ItemPositionType = NonLegacyPosition); | |
17 // Style data for Content-Distribution properties: align-content, justify-co ntent. | |
18 // <content-distribution> || [ <overflow-position>? && <content-position> ] | |
19 StyleAlignmentData(ContentPosition, ContentDistributionType, OverflowAlignme nt = OverflowAlignmentDefault); | |
20 | |
21 bool operator==(const StyleAlignmentData& o) const | |
22 { | |
23 return m_itemPosition == o.m_itemPosition && m_contentPosition == o.m_co ntentPosition && m_distribution == o.m_distribution && m_positionType == o.m_pos itionType && m_overflow == o.m_overflow; | |
24 } | |
25 | |
26 bool operator==(ItemPosition position) const | |
Timothy Loh
2015/04/13 00:56:43
These overloads seem a bit weird to me, why do we
Julien - ping for review
2015/04/13 14:46:20
They are used above when we do e.g. justifyItems()
jfernandez
2015/04/14 00:18:43
Done.
esprehn
2015/04/14 00:48:55
I'd like to avoid an operator== overload to a tota
jfernandez
2015/04/14 22:56:21
Acknowledged.
| |
27 { | |
28 return m_itemPosition == position; | |
29 } | |
30 | |
31 bool operator==(ContentPosition position) const | |
32 { | |
33 return m_contentPosition == position; | |
34 } | |
35 | |
36 bool operator==(ContentDistributionType distribution) const | |
37 { | |
38 return m_distribution == distribution; | |
39 } | |
40 | |
41 bool operator==(ItemPositionType positionType) const | |
esprehn
2015/04/14 00:48:55
Can we remove these and instead be explicit.
jfernandez
2015/04/14 22:56:21
Yes, it'd be a good idea. However, I finally remov
| |
42 { | |
43 return m_positionType == positionType; | |
44 } | |
45 | |
46 bool operator!=(const StyleAlignmentData& o) const | |
47 { | |
48 return !(*this == o); | |
49 } | |
50 | |
51 unsigned m_itemPosition : 4; // ItemPosition | |
esprehn
2015/04/14 00:48:55
Remove the m_ prefix if these are going to be publ
jfernandez
2015/04/14 22:56:20
I finally made private the class fields, so they s
| |
52 unsigned m_contentPosition : 4; // ContentPosition | |
53 unsigned m_distribution : 3; // ContentDistributionType | |
54 unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' ke yword. | |
55 unsigned m_overflow : 2; // OverflowAlignment | |
56 }; | |
57 | |
58 } // namespace blink | |
59 | |
60 #endif // StyleAlignmentData_h | |
OLD | NEW |