OLD | NEW |
(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 StyleContentAlignmentData_h |
| 6 #define StyleContentAlignmentData_h |
| 7 |
| 8 #include "core/style/ComputedStyleConstants.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class StyleContentAlignmentData { |
| 13 public: |
| 14 // Style data for Content-Distribution properties: align-content, justify-co
ntent. |
| 15 // <content-distribution> || [ <overflow-position>? && <content-position> ] |
| 16 StyleContentAlignmentData(ContentPosition position, ContentDistributionType
distribution, OverflowAlignment overflow = OverflowAlignmentDefault) |
| 17 : m_position(position) |
| 18 , m_distribution(distribution) |
| 19 , m_overflow(overflow) |
| 20 { |
| 21 } |
| 22 |
| 23 void setPosition(ContentPosition position) { m_position = position; } |
| 24 void setDistribution(ContentDistributionType distribution) { m_distribution
= distribution; } |
| 25 void setOverflow(OverflowAlignment overflow) { m_overflow = overflow; } |
| 26 |
| 27 ContentPosition position() const { return static_cast<ContentPosition>(m_pos
ition); } |
| 28 ContentDistributionType distribution() const { return static_cast<ContentDis
tributionType>(m_distribution); } |
| 29 OverflowAlignment overflow() const { return static_cast<OverflowAlignment>(m
_overflow); } |
| 30 |
| 31 bool operator==(const StyleContentAlignmentData& o) const |
| 32 { |
| 33 return m_position == o.m_position && m_distribution == o.m_distribution
&& m_overflow == o.m_overflow; |
| 34 } |
| 35 |
| 36 bool operator!=(const StyleContentAlignmentData& o) const |
| 37 { |
| 38 return !(*this == o); |
| 39 } |
| 40 |
| 41 private: |
| 42 unsigned m_position : 4; // ContentPosition |
| 43 unsigned m_distribution : 3; // ContentDistributionType |
| 44 unsigned m_overflow : 2; // OverflowAlignment |
| 45 }; |
| 46 |
| 47 } // namespace blink |
| 48 |
| 49 #endif // StyleContentAlignmentData_h |
OLD | NEW |