| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CSSColorValue_h | 5 #ifndef CSSColorValue_h |
| 6 #define CSSColorValue_h | 6 #define CSSColorValue_h |
| 7 | 7 |
| 8 #include "core/css/CSSValue.h" | 8 #include "core/css/CSSValue.h" |
| 9 #include "platform/graphics/Color.h" | 9 #include "platform/graphics/Color.h" |
| 10 #include "wtf/PassRefPtr.h" | 10 #include "wtf/PassRefPtr.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class CSSValuePool; |
| 15 |
| 16 namespace cssvalue { |
| 17 |
| 14 // Represents the non-keyword subset of <color>. | 18 // Represents the non-keyword subset of <color>. |
| 15 class CSSColorValue : public CSSValue { | 19 class CSSColorValue : public CSSValue { |
| 16 public: | 20 public: |
| 17 // TODO(sashab): Make this create() method take a Color instead. | 21 // TODO(sashab): Make this create() method take a Color instead. |
| 18 static CSSColorValue* create(RGBA32 color); | 22 static CSSColorValue* create(RGBA32 color); |
| 19 | 23 |
| 20 String customCSSText() const { | 24 String customCSSText() const { |
| 21 return m_color.serializedAsCSSComponentValue(); | 25 return m_color.serializedAsCSSComponentValue(); |
| 22 } | 26 } |
| 23 | 27 |
| 24 Color value() const { return m_color; } | 28 Color value() const { return m_color; } |
| 25 | 29 |
| 26 bool equals(const CSSColorValue& other) const { | 30 bool equals(const CSSColorValue& other) const { |
| 27 return m_color == other.m_color; | 31 return m_color == other.m_color; |
| 28 } | 32 } |
| 29 | 33 |
| 30 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { | 34 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { |
| 31 CSSValue::traceAfterDispatch(visitor); | 35 CSSValue::traceAfterDispatch(visitor); |
| 32 } | 36 } |
| 33 | 37 |
| 34 private: | 38 private: |
| 35 friend class CSSValuePool; | 39 friend class ::blink::CSSValuePool; |
| 36 | 40 |
| 37 CSSColorValue(Color color) : CSSValue(ColorClass), m_color(color) {} | 41 CSSColorValue(Color color) : CSSValue(ColorClass), m_color(color) {} |
| 38 | 42 |
| 39 Color m_color; | 43 Color m_color; |
| 40 }; | 44 }; |
| 41 | 45 |
| 42 DEFINE_CSS_VALUE_TYPE_CASTS(CSSColorValue, isColorValue()); | 46 DEFINE_CSS_VALUE_TYPE_CASTS(CSSColorValue, isColorValue()); |
| 43 | 47 |
| 48 } // namespace cssvalue |
| 44 } // namespace blink | 49 } // namespace blink |
| 45 | 50 |
| 46 #endif // CSSColorValue_h | 51 #endif // CSSColorValue_h |
| OLD | NEW |