| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef AppliedTextDecoration_h | 5 #ifndef AppliedTextDecoration_h |
| 6 #define AppliedTextDecoration_h | 6 #define AppliedTextDecoration_h |
| 7 | 7 |
| 8 #include "core/css/StyleColor.h" | 8 #include "core/css/StyleColor.h" |
| 9 #include "core/style/ComputedStyleConstants.h" | 9 #include "core/style/ComputedStyleConstants.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class AppliedTextDecoration { | 14 class AppliedTextDecoration { |
| 15 ALLOW_ONLY_INLINE_ALLOCATION(); | 15 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 16 public: | 16 public: |
| 17 AppliedTextDecoration(TextDecoration, TextDecorationStyle, StyleColor); | 17 AppliedTextDecoration(TextDecoration, TextDecorationStyle, Color, bool isAff
ectedByPropagatedColors = false); |
| 18 explicit AppliedTextDecoration(TextDecoration); | 18 explicit AppliedTextDecoration(TextDecoration); |
| 19 | 19 |
| 20 TextDecoration line() const { return static_cast<TextDecoration>(m_line); } | 20 TextDecoration lines() const { return static_cast<TextDecoration>(m_lines);
} |
| 21 TextDecorationStyle style() const { return static_cast<TextDecorationStyle>(
m_style); } | 21 TextDecorationStyle style() const { return static_cast<TextDecorationStyle>(
m_style); } |
| 22 Color color() const { return m_color; } |
| 23 bool isAffectedByPropagatedColors() const { return m_isAffectedByPropagatedC
olors; } |
| 22 | 24 |
| 23 bool isSimpleUnderline() const { return m_line == TextDecorationUnderline &&
m_style == TextDecorationStyleSolid && m_color.isCurrentColor(); } | 25 void applyPropagatedColor(Color color) |
| 26 { |
| 27 ASSERT(m_isAffectedByPropagatedColors); |
| 28 m_color = color; |
| 29 } |
| 30 |
| 24 bool operator==(const AppliedTextDecoration&) const; | 31 bool operator==(const AppliedTextDecoration&) const; |
| 25 bool operator!=(const AppliedTextDecoration& o) const { return !(*this == o)
; } | 32 bool operator!=(const AppliedTextDecoration& o) const { return !(*this == o)
; } |
| 26 | 33 |
| 27 private: | 34 private: |
| 28 unsigned m_line : TextDecorationBits; | 35 unsigned m_lines : TextDecorationBits; |
| 29 unsigned m_style : 3; // TextDecorationStyle | 36 unsigned m_style : 3; // TextDecorationStyle |
| 30 StyleColor m_color; | 37 unsigned m_isAffectedByPropagatedColors : 1; |
| 38 Color m_color; |
| 31 }; | 39 }; |
| 32 | 40 |
| 33 } // namespace blink | 41 } // namespace blink |
| 34 | 42 |
| 35 #endif // AppliedTextDecoration_h | 43 #endif // AppliedTextDecoration_h |
| OLD | NEW |