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

Unified Diff: Source/core/style/StyleContentAlignmentData.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/ComputedStyle.cpp ('k') | Source/core/style/StyleRareNonInheritedData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/StyleContentAlignmentData.h
diff --git a/Source/core/style/StyleContentAlignmentData.h b/Source/core/style/StyleContentAlignmentData.h
new file mode 100644
index 0000000000000000000000000000000000000000..0540b3a4298d35c93c01dbadd52caf71ccbb11b5
--- /dev/null
+++ b/Source/core/style/StyleContentAlignmentData.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 StyleContentAlignmentData_h
+#define StyleContentAlignmentData_h
+
+#include "core/style/ComputedStyleConstants.h"
+
+namespace blink {
+
+class StyleContentAlignmentData {
+public:
+ // Style data for Content-Distribution properties: align-content, justify-content.
+ // <content-distribution> || [ <overflow-position>? && <content-position> ]
+ StyleContentAlignmentData(ContentPosition position, ContentDistributionType distribution, OverflowAlignment overflow = OverflowAlignmentDefault)
+ : m_position(position)
+ , m_distribution(distribution)
+ , m_overflow(overflow)
+ {
+ }
+
+ void setPosition(ContentPosition position) { m_position = position; }
+ void setDistribution(ContentDistributionType distribution) { m_distribution = distribution; }
+ void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
+
+ ContentPosition position() const { return static_cast<ContentPosition>(m_position); }
+ ContentDistributionType distribution() const { return static_cast<ContentDistributionType>(m_distribution); }
+ OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
+
+ bool operator==(const StyleContentAlignmentData& o) const
+ {
+ return m_position == o.m_position && m_distribution == o.m_distribution && m_overflow == o.m_overflow;
+ }
+
+ bool operator!=(const StyleContentAlignmentData& o) const
+ {
+ return !(*this == o);
+ }
+
+private:
+ unsigned m_position : 4; // ContentPosition
+ unsigned m_distribution : 3; // ContentDistributionType
+ unsigned m_overflow : 2; // OverflowAlignment
+};
+
+} // namespace blink
+
+#endif // StyleContentAlignmentData_h
« no previous file with comments | « Source/core/style/ComputedStyle.cpp ('k') | Source/core/style/StyleRareNonInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698