Chromium Code Reviews| Index: Source/core/css/CSSStringValueBase.h |
| diff --git a/Source/core/css/CSSStringValueBase.h b/Source/core/css/CSSStringValueBase.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b9fe9e9c3bd6d3ce042e55928348b3f735afa543 |
| --- /dev/null |
| +++ b/Source/core/css/CSSStringValueBase.h |
| @@ -0,0 +1,55 @@ |
| +// 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 CSSStringValueBase_h |
| +#define CSSStringValueBase_h |
| + |
| +#include "core/CoreExport.h" |
| +#include "core/css/CSSValue.h" |
| +#include "wtf/PassRefPtr.h" |
| +#include "wtf/RefCounted.h" |
| + |
| +namespace blink { |
| + |
| +template <CSSValue::ClassType T> |
| +class CORE_EXPORT CSSStringValueBase : public CSSValue { |
|
Timothy Loh
2015/09/17 05:35:01
does this need to CORE_EXPORT?
sashab
2015/09/21 01:13:27
Nope; removed.
|
| +public: |
| + static PassRefPtrWillBeRawPtr<CSSStringValueBase> create(const String& str) |
| + { |
| + return adoptRefWillBeNoop(new CSSStringValueBase(str)); |
| + } |
| + |
| + String value() const { return m_string; } |
| + |
| + String customCSSText() const; |
| + |
| + bool equals(const CSSStringValueBase& other) const |
| + { |
| + return m_string == other.m_string; |
| + } |
| + |
| + DEFINE_INLINE_TRACE_AFTER_DISPATCH() |
| + { |
| + CSSValue::traceAfterDispatch(visitor); |
| + } |
| + |
| +private: |
| + CSSStringValueBase(const String& str) |
| + : CSSValue(T) |
| + , m_string(str) { } |
| + |
| + String m_string; |
| +}; |
| + |
| +using CSSStringValue = CSSStringValueBase<CSSValue::StringClass>; |
| +using CSSCustomIdentValue = CSSStringValueBase<CSSValue::CustomIdentClass>; |
| +using CSSURIValue = CSSStringValueBase<CSSValue::URIClass>; |
| + |
| +DEFINE_CSS_VALUE_TYPE_CASTS(CSSStringValue, isStringValue()); |
| +DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); |
| +DEFINE_CSS_VALUE_TYPE_CASTS(CSSURIValue, isURIValue()); |
| + |
| +} // namespace blink |
| + |
| +#endif // CSSStringValueBase_h |