Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1842)

Unified Diff: Source/core/style/StyleSelfAlignmentData.h

Issue 1070143002: [Alignment] Single class for holding the alignment data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased and got back previous setter names. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/style/StyleRareNonInheritedData.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/StyleSelfAlignmentData.h
diff --git a/Source/core/style/StyleSelfAlignmentData.h b/Source/core/style/StyleSelfAlignmentData.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cd01fbc8f63cb871f0e35ac42a4def7f283bebe
--- /dev/null
+++ b/Source/core/style/StyleSelfAlignmentData.h
@@ -0,0 +1,49 @@
+// 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 StyleSelfAlignmentData_h
+#define StyleSelfAlignmentData_h
+
+#include "core/style/ComputedStyleConstants.h"
+
+namespace blink {
+
+class StyleSelfAlignmentData {
+public:
+ // Style data for Self-Aligment and Default-Alignment properties: align-{self, items}, justify-{self, items}.
+ // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ]
+ StyleSelfAlignmentData(ItemPosition position, OverflowAlignment overflow, ItemPositionType positionType = NonLegacyPosition)
+ : m_position(position)
+ , m_positionType(positionType)
+ , m_overflow(overflow)
+ {
+ }
+
+ void setPosition(ItemPosition position) { m_position = position; }
+ void setPositionType(ItemPositionType positionType) { m_positionType = positionType; }
+ void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
+
+ ItemPosition position() const { return static_cast<ItemPosition>(m_position); }
+ ItemPositionType positionType() const { return static_cast<ItemPositionType>(m_positionType); }
+ OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
+
+ bool operator==(const StyleSelfAlignmentData& o) const
+ {
+ return m_position == o.m_position && m_positionType == o.m_positionType && m_overflow == o.m_overflow;
+ }
+
+ bool operator!=(const StyleSelfAlignmentData& o) const
+ {
+ return !(*this == o);
+ }
+
+private:
+ unsigned m_position : 4; // ItemPosition
+ unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' keyword.
+ unsigned m_overflow : 2; // OverflowAlignment
+};
+
+} // namespace blink
+
+#endif // StyleSelfAlignmentData_h
« no previous file with comments | « Source/core/style/StyleRareNonInheritedData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698