Index: third_party/WebKit/Source/core/css/CSSStringValues.cpp |
diff --git a/third_party/WebKit/Source/core/css/CSSStringValues.cpp b/third_party/WebKit/Source/core/css/CSSStringValues.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a6f132bcaa0d641cdd6730da495eb0d808c03d99 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/CSSStringValues.cpp |
@@ -0,0 +1,63 @@ |
+// 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. |
+ |
+#include "config.h" |
+#include "core/css/CSSStringValues.h" |
+ |
+#include "core/css/CSSMarkup.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+namespace { |
Timothy Loh
2015/09/25 05:44:16
..please read over your patches before sending the
|
+ |
+} // namespace |
+ |
+CSSStringValue::CSSStringValue(const String& str) |
+ : CSSValue(StringClass) |
+ , m_string(str) { } |
+ |
+String CSSStringValue::customCSSText() const |
+{ |
+ return serializeString(m_string); |
+} |
+ |
+CSSCustomIdentValue::CSSCustomIdentValue(const String& str) |
+ : CSSValue(CustomIdentClass), |
+ m_isPropertyID(false), |
+ m_string(str) { } |
+ |
+CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID propertyID) |
+ : CSSValue(CustomIdentClass), |
+ m_isPropertyID(true), |
+ m_id(propertyID) { } |
+ |
+String CSSCustomIdentValue::customCSSText() const |
+{ |
+ if (m_isPropertyID) |
+ return getPropertyNameAtomicString(m_id); |
+ return quoteCSSStringIfNeeded(m_string); |
+} |
+ |
+bool CSSCustomIdentValue::equals(const CSSCustomIdentValue& other) const |
+{ |
+ if (m_isPropertyID != other.m_isPropertyID) |
+ return false; |
+ |
+ if (m_isPropertyID) |
+ return m_id == other.m_id; |
+ return m_string == other.m_string; |
+} |
+ |
+CSSURIValue::CSSURIValue(const String& str) |
+ : CSSValue(URIClass) |
+ , m_string(str) { } |
+ |
+ |
+String CSSURIValue::customCSSText() const |
+{ |
+ return "url(" + quoteCSSURLIfNeeded(m_string) + ")"; |
+} |
+ |
+} // namespace blink |