Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / style / StyleSelfAlignmentData.h
blob23030a84bfdf403afe722055cebebe551a611d4c
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.
5 #ifndef StyleSelfAlignmentData_h
6 #define StyleSelfAlignmentData_h
8 #include "core/style/ComputedStyleConstants.h"
9 #include "wtf/Allocator.h"
11 namespace blink {
13 class StyleSelfAlignmentData {
14 DISALLOW_ALLOCATION();
15 public:
16 // Style data for Self-Aligment and Default-Alignment properties: align-{self, items}, justify-{self, items}.
17 // [ <self-position> && <overflow-position>? ] | [ legacy && [ left | right | center ] ]
18 StyleSelfAlignmentData(ItemPosition position, OverflowAlignment overflow, ItemPositionType positionType = NonLegacyPosition)
19 : m_position(position)
20 , m_positionType(positionType)
21 , m_overflow(overflow)
25 void setPosition(ItemPosition position) { m_position = position; }
26 void setPositionType(ItemPositionType positionType) { m_positionType = positionType; }
27 void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; }
29 ItemPosition position() const { return static_cast<ItemPosition>(m_position); }
30 ItemPositionType positionType() const { return static_cast<ItemPositionType>(m_positionType); }
31 OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m_overflow); }
33 bool operator==(const StyleSelfAlignmentData& o) const
35 return m_position == o.m_position && m_positionType == o.m_positionType && m_overflow == o.m_overflow;
38 bool operator!=(const StyleSelfAlignmentData& o) const
40 return !(*this == o);
43 private:
44 unsigned m_position : 4; // ItemPosition
45 unsigned m_positionType: 1; // Whether or not alignment uses the 'legacy' keyword.
46 unsigned m_overflow : 2; // OverflowAlignment
49 } // namespace blink
51 #endif // StyleSelfAlignmentData_h