Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: Source/core/css/CSSVariableValue.h

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 CSSVariableValue_h
6 #define CSSVariableValue_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 CSSTokenizerScope;
16
17 class CSSVariableValue : public CSSValue {
18 public:
19 static PassRefPtrWillBeRawPtr<CSSVariableValue> create(const AtomicString& n ame, PassRefPtr<CSSVariableData> value)
20 {
21 return adoptRefWillBeNoop(new CSSVariableValue(name, value));
22 }
23
24 static PassRefPtrWillBeRawPtr<CSSVariableValue> create(const AtomicString& n ame, CSSValueID id)
25 {
26 return adoptRefWillBeNoop(new CSSVariableValue(name, id));
27 }
28
29 const AtomicString& name() const { return m_name; }
30 CSSVariableData* value() const { return m_value.get(); }
31 CSSValueID id() const { return m_valueId; }
32
33 bool equals(const CSSVariableValue& other) const { return this == &other; }
34
35 void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(vis itor); }
36
37 private:
38 CSSVariableValue(const AtomicString& name, CSSValueID id)
39 : CSSValue(VariableClass)
40 , m_name(name)
41 , m_value(nullptr)
42 , m_valueId(id)
43 {
44 ASSERT(id == CSSValueInherit || id == CSSValueInitial);
45 }
46
47 CSSVariableValue(const AtomicString& name, PassRefPtr<CSSVariableData> v alue)
48 : CSSValue(VariableClass)
49 , m_name(name)
50 , m_value(value)
51 , m_valueId(CSSValueInternalVariableValue)
52 {
53 }
54
55 const AtomicString m_name;
56 RefPtr<CSSVariableData> m_value;
57 CSSValueID m_valueId;
58 };
59
60 DEFINE_CSS_VALUE_TYPE_CASTS(CSSVariableValue, isVariableValue());
61
62 } // namespace blink
63
64 #endif // CSSVariableValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698