Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: third_party/WebKit/Source/core/css/CSSStringValues.cpp

Issue 1373433002: Split out CSSPrimitiveValue's PropertyID into CSSCustomIdentValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_string
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698