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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/style/StyleRareNonInheritedData.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 StyleSelfAlignmentData_h
6 #define StyleSelfAlignmentData_h
7
8 #include "core/style/ComputedStyleConstants.h"
9
10 namespace blink {
11
12 class StyleSelfAlignmentData {
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 StyleSelfAlignmentData(ItemPosition position, OverflowAlignment overflow, It emPositionType positionType = NonLegacyPosition)
17 : m_position(position)
18 , m_positionType(positionType)
19 , m_overflow(overflow)
20 {
21 }
22
23 void setPosition(ItemPosition position) { m_position = position; }
24 void setPositionType(ItemPositionType positionType) { m_positionType = posit ionType; }
25 void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
26
27 ItemPosition position() const { return static_cast<ItemPosition>(m_position) ; }
28 ItemPositionType positionType() const { return static_cast<ItemPositionType> (m_positionType); }
29 OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m _overflow); }
30
31 bool operator==(const StyleSelfAlignmentData& o) const
32 {
33 return m_position == o.m_position && m_positionType == o.m_positionType && m_overflow == o.m_overflow;
34 }
35
36 bool operator!=(const StyleSelfAlignmentData& o) const
37 {
38 return !(*this == o);
39 }
40
41 private:
42 unsigned m_position : 4; // ItemPosition
43 unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' ke yword.
44 unsigned m_overflow : 2; // OverflowAlignment
45 };
46
47 } // namespace blink
48
49 #endif // StyleSelfAlignmentData_h
OLDNEW
« 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