Index: third_party/WebKit/Source/core/css/CSSStringValues.h |
diff --git a/third_party/WebKit/Source/core/css/CSSStringValues.h b/third_party/WebKit/Source/core/css/CSSStringValues.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..19001a82292e897af47476b6d937106eac3eded6 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/CSSStringValues.h |
@@ -0,0 +1,92 @@ |
+// 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 CSSStringValues_h |
+#define CSSStringValues_h |
+ |
+#include "core/CSSPropertyNames.h" |
+#include "core/CoreExport.h" |
+#include "core/css/CSSValue.h" |
+#include "wtf/PassRefPtr.h" |
+#include "wtf/RefCounted.h" |
+ |
+namespace blink { |
+ |
+class CSSStringValue : public CSSValue { |
+public: |
+ static PassRefPtrWillBeRawPtr<CSSStringValue> create(const String& str) |
+ { |
+ return adoptRefWillBeNoop(new CSSStringValue(str)); |
+ } |
+ |
+ String value() const { return m_string; } |
+ String customCSSText() const; |
+ |
+ bool equals(const CSSStringValue& other) const { return m_string == other.m_string; } |
+ |
+ DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor); } |
+private: |
+ CSSStringValue(const String&); |
+ |
+ String m_string; |
+}; |
+ |
+class CSSCustomIdentValue : public CSSValue { |
Timothy Loh
2015/09/25 05:44:16
one class per header file
|
+public: |
+ static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(const String& str) |
+ { |
+ return adoptRefWillBeNoop(new CSSCustomIdentValue(str)); |
+ } |
+ |
+ static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(CSSPropertyID propertyID) |
Timothy Loh
2015/09/25 05:44:16
I think this class would look better as:
{
public
sashab
2015/09/28 03:37:03
Changing all the callsites in the parser to pass t
alancutter (OOO until 2018)
2015/09/30 02:08:50
For now we can just use CSSPropertyInvalid to indi
|
+ { |
+ return adoptRefWillBeNoop(new CSSCustomIdentValue(propertyID)); |
+ } |
+ |
+ String string() const { ASSERT(!m_isPropertyID); return m_string; } |
+ CSSPropertyID id() const { ASSERT(m_isPropertyID); return m_id; } |
+ bool isValidPropertyID() const { return m_isPropertyID; } |
+ |
+ String customCSSText() const; |
+ |
+ bool equals(const CSSCustomIdentValue& other) const; |
+ |
+ DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor); } |
+private: |
+ CSSCustomIdentValue(const String&); |
+ CSSCustomIdentValue(CSSPropertyID); |
+ |
+ bool m_isPropertyID; |
+ |
+ // TODO(sashab): Store these in a union. |
Timothy Loh
2015/09/25 05:44:16
let's not do this
|
+ String m_string; |
+ CSSPropertyID m_id; |
+}; |
+ |
+class CSSURIValue : public CSSValue { |
+public: |
+ static PassRefPtrWillBeRawPtr<CSSURIValue> create(const String& str) |
+ { |
+ return adoptRefWillBeNoop(new CSSURIValue(str)); |
+ } |
+ |
+ String value() const { return m_string; } |
+ String customCSSText() const; |
+ |
+ bool equals(const CSSURIValue& other) const { return m_string == other.m_string; } |
+ |
+ DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor); } |
+private: |
+ CSSURIValue(const String&); |
+ |
+ String m_string; |
+}; |
+ |
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSStringValue, isStringValue()); |
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); |
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSURIValue, isURIValue()); |
+ |
+} // namespace blink |
+ |
+#endif // CSSStringValues_h |