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

Unified Diff: Source/core/css/CSSVariableValue.h

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: with missing files 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/CSSVariableValue.h
diff --git a/Source/core/css/CSSVariableValue.h b/Source/core/css/CSSVariableValue.h
new file mode 100644
index 0000000000000000000000000000000000000000..c13d80c6551c7845c53eaa6b1056721919e5d10b
--- /dev/null
+++ b/Source/core/css/CSSVariableValue.h
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CSSVariableValue_h
+#define CSSVariableValue_h
+
+#include "core/css/CSSValue.h"
+#include "core/css/CSSVariableData.h"
+#include "wtf/RefPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace blink {
+
+class CSSVariableValue : public CSSValue {
alancutter (OOO until 2018) 2015/06/26 06:56:07 I'd call this CSSCustomPropertyValue to stay close
+public:
+ static PassRefPtrWillBeRawPtr<CSSVariableValue> create(const AtomicString& name, PassRefPtr<CSSVariableData> value)
+ {
+ return adoptRefWillBeNoop(new CSSVariableValue(name, value));
+ }
+
+ static PassRefPtrWillBeRawPtr<CSSVariableValue> create(const AtomicString& name, CSSValueID id)
+ {
+ return adoptRefWillBeNoop(new CSSVariableValue(name, id));
+ }
+
+ const AtomicString& name() const { return m_name; }
+ CSSVariableData* value() const { return m_value.get(); }
+ CSSValueID id() const { return m_valueId; }
+
+ bool equals(const CSSVariableValue& other) const { return this == &other; }
+
+ void traceAfterDispatch(Visitor* visitor) { CSSValue::traceAfterDispatch(visitor); }
+
+private:
+ CSSVariableValue(const AtomicString& name, CSSValueID id)
+ : CSSValue(VariableClass)
+ , m_name(name)
+ , m_value(nullptr)
+ , m_valueId(id)
+ {
+ ASSERT(id == CSSValueInherit || id == CSSValueInitial);
+ }
+
+ CSSVariableValue(const AtomicString& name, PassRefPtr<CSSVariableData> value)
+ : CSSValue(VariableClass)
+ , m_name(name)
+ , m_value(value)
+ , m_valueId(CSSValueInternalVariableValue)
+ {
+ }
+
+ const AtomicString m_name;
+ RefPtr<CSSVariableData> m_value;
+ CSSValueID m_valueId;
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSVariableValue, isVariableValue());
+
+} // namespace blink
+
+#endif // CSSVariableValue_h

Powered by Google App Engine
This is Rietveld 408576698