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

Unified Diff: third_party/WebKit/Source/core/css/CSSIdentifierValue.h

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 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/CSSIdentifierValue.h
diff --git a/third_party/WebKit/Source/core/css/CSSIdentifierValue.h b/third_party/WebKit/Source/core/css/CSSIdentifierValue.h
new file mode 100644
index 0000000000000000000000000000000000000000..11a64879a356e9e72f35667f2b6ba69c2a448a72
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSIdentifierValue.h
@@ -0,0 +1,62 @@
+// Copyright 2016 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 CSSIdentifierValue_h
+#define CSSIdentifierValue_h
+
+#include "core/CSSValueKeywords.h"
+#include "core/css/CSSValue.h"
+#include "wtf/TypeTraits.h"
+
+namespace blink {
+
+// CSSIdentifierValue stores CSS value keywords, e.g. 'none', 'auto', 'lower-roman'.
+// TODO(sashab): Rename this class to CSSKeywordValue once it no longer conflicts
+// with CSSOM's CSSKeywordValue class.
+class CORE_EXPORT CSSIdentifierValue : public CSSValue {
+public:
+ static CSSIdentifierValue* create(CSSValueID);
+
+ // TODO(sashab): Rename this to createFromPlatformValue().
+ template<typename T> static CSSIdentifierValue* create(T value)
+ {
+ static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead");
+ return new CSSIdentifierValue(value);
+ }
+
+ static CSSIdentifierValue* create(const Length& value)
+ {
+ return new CSSIdentifierValue(value);
+ }
+
+ CSSValueID getValueID() const { return m_valueID; }
+
+ String customCSSText() const;
+
+ bool equals(const CSSIdentifierValue& other) const
+ {
+ return m_valueID == other.m_valueID;
+ }
+
+ template<typename T> inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h
+
+ DECLARE_TRACE_AFTER_DISPATCH();
+
+private:
+ explicit CSSIdentifierValue(CSSValueID);
+
+ // TODO(sashab): Remove this function, and update mapping methods to specialize
+ // the create() method instead.
+ template<typename T> CSSIdentifierValue(T); // Defined in CSSPrimitiveValueMappings.h
+
+ CSSIdentifierValue(const Length&);
+
+ CSSValueID m_valueID;
+};
+
+DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue());
+
+} // namespace blink
+
+#endif // CSSIdentifierValue_h
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSGradientValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSIdentifierValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698