Index: Source/core/css/CSSStringValue.h |
diff --git a/Source/core/css/CSSStringValue.h b/Source/core/css/CSSStringValue.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e0540dd72dc90a5a5394f2bbd1f8a8fb5ad6bb95 |
--- /dev/null |
+++ b/Source/core/css/CSSStringValue.h |
@@ -0,0 +1,58 @@ |
+// 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 CSSStringValue_h |
+#define CSSStringValue_h |
+ |
+#include "core/CoreExport.h" |
+#include "core/css/CSSValue.h" |
+#include "wtf/PassRefPtr.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+class CORE_EXPORT CSSStringValue : public CSSValue { |
+public: |
+ enum SerializationType { SerializeAsString, SerializeAsCustomIdentifier, SerializeAsURI }; |
+ |
+ static PassRefPtrWillBeRawPtr<CSSStringValue> create(const String& str, SerializationType serializationType) |
+ { |
+ return adoptRefWillBeNoop(new CSSStringValue(str, serializationType)); |
+ } |
+ |
+ ~CSSStringValue(); |
+ |
+ String getStringValue() const { return m_string; } |
+ SerializationType serializationType() const { return m_serializationType; } |
+ |
+ String customCSSText() const; |
+ |
+ bool equals(const CSSStringValue& other) const |
+ { |
+ return m_serializationType == other.m_serializationType |
+ && equal(m_string, other.m_string); |
+ } |
+ |
+ DECLARE_TRACE_AFTER_DISPATCH(); |
+ |
+private: |
+ CSSStringValue(const String& str, SerializationType serializationType) |
+ : CSSValue(StringClass) |
+ , m_string(str.impl()) |
+ , m_serializationType(serializationType) |
+ { |
+ if (m_string) |
+ m_string->ref(); |
+ } |
+ |
+ StringImpl* m_string; |
Timothy Loh
2015/08/31 06:32:47
..just store a String :\
|
+ SerializationType m_serializationType; |
+}; |
+ |
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSStringValue, isStringValue()); |
+ |
+} // namespace |
+ |
+#endif // CSSStringValue_h |