Chromium Code Reviews| 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 |