Index: Source/core/style/StyleAlignmentData.h |
diff --git a/Source/core/style/StyleAlignmentData.h b/Source/core/style/StyleAlignmentData.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..47e9237c0819e668cddaad0c3550df2c9e65231b |
--- /dev/null |
+++ b/Source/core/style/StyleAlignmentData.h |
@@ -0,0 +1,60 @@ |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef StyleAlignmentData_h |
+#define StyleAlignmentData_h |
+ |
+#include "core/style/ComputedStyleConstants.h" |
+ |
+namespace blink { |
+ |
+class StyleAlignmentData { |
+public: |
+ // Style data for Self-Aligment and Default-Alignment properties: align-{self, items}, justify-{self, items}. |
+ // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ] |
+ StyleAlignmentData(ItemPosition, OverflowAlignment = OverflowAlignmentDefault, ItemPositionType = NonLegacyPosition); |
+ // Style data for Content-Distribution properties: align-content, justify-content. |
+ // <content-distribution> || [ <overflow-position>? && <content-position> ] |
+ StyleAlignmentData(ContentPosition, ContentDistributionType, OverflowAlignment = OverflowAlignmentDefault); |
+ |
+ bool operator==(const StyleAlignmentData& o) const |
+ { |
+ return m_itemPosition == o.m_itemPosition && m_contentPosition == o.m_contentPosition && m_distribution == o.m_distribution && m_positionType == o.m_positionType && m_overflow == o.m_overflow; |
+ } |
+ |
+ 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.
|
+ { |
+ return m_itemPosition == position; |
+ } |
+ |
+ bool operator==(ContentPosition position) const |
+ { |
+ return m_contentPosition == position; |
+ } |
+ |
+ bool operator==(ContentDistributionType distribution) const |
+ { |
+ return m_distribution == distribution; |
+ } |
+ |
+ 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
|
+ { |
+ return m_positionType == positionType; |
+ } |
+ |
+ bool operator!=(const StyleAlignmentData& o) const |
+ { |
+ return !(*this == o); |
+ } |
+ |
+ 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
|
+ unsigned m_contentPosition : 4; // ContentPosition |
+ unsigned m_distribution : 3; // ContentDistributionType |
+ unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' keyword. |
+ unsigned m_overflow : 2; // OverflowAlignment |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // StyleAlignmentData_h |