OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CSSCustomPropertyDeclaration_h | |
6 #define CSSCustomPropertyDeclaration_h | |
7 | |
8 #include "core/css/CSSValue.h" | |
9 #include "core/css/CSSVariableData.h" | |
10 #include "wtf/RefPtr.h" | |
11 #include "wtf/text/AtomicString.h" | |
12 | |
13 namespace blink { | |
14 | |
15 class CSSCustomPropertyDeclaration : public CSSValue { | |
16 public: | |
17 static PassRefPtrWillBeRawPtr<CSSCustomPropertyDeclaration> create(const Ato
micString& name, PassRefPtr<CSSVariableData> value) | |
18 { | |
19 return adoptRefWillBeNoop(new CSSCustomPropertyDeclaration(name, value))
; | |
20 } | |
21 | |
22 static PassRefPtrWillBeRawPtr<CSSCustomPropertyDeclaration> create(const Ato
micString& name, CSSValueID id) | |
23 { | |
24 return adoptRefWillBeNoop(new CSSCustomPropertyDeclaration(name, id)); | |
25 } | |
26 | |
27 const AtomicString& name() const { return m_name; } | |
28 CSSVariableData* value() const { return m_value.get(); } | |
29 CSSValueID id() const { return m_valueId; } | |
30 | |
31 bool equals(const CSSCustomPropertyDeclaration& other) const { return this =
= &other; } | |
32 | |
33 DECLARE_TRACE_AFTER_DISPATCH(); | |
34 private: | |
35 CSSCustomPropertyDeclaration(const AtomicString& name, CSSValueID id) | |
36 : CSSValue(CustomPropertyDeclarationClass) | |
37 , m_name(name) | |
38 , m_value(nullptr) | |
39 , m_valueId(id) | |
40 { | |
41 ASSERT(id == CSSValueInherit || id == CSSValueInitial || id == CSSValueU
nset); | |
42 } | |
43 | |
44 CSSCustomPropertyDeclaration(const AtomicString& name, PassRefPtr<CSSVariabl
eData> value) | |
45 : CSSValue(CustomPropertyDeclarationClass) | |
46 , m_name(name) | |
47 , m_value(value) | |
48 , m_valueId(CSSValueInternalVariableValue) | |
49 { | |
50 } | |
51 | |
52 const AtomicString m_name; | |
53 RefPtr<CSSVariableData> m_value; | |
54 CSSValueID m_valueId; | |
55 }; | |
56 | |
57 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomPropertyDeclaration, isCustomPropertyDeclar
ation()); | |
58 | |
59 } // namespace blink | |
60 | |
61 #endif // CSSCustomPropertyDeclaration_h | |
OLD | NEW |