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

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

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Replaced ASSERTs with DCHECKS in presubmit warnings 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..d3ca59dee170f3c19f246c8cd426aed98a078429
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/CSSIdentifierValue.h
@@ -0,0 +1,60 @@
+// 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 {
+
+class CORE_EXPORT CSSIdentifierValue : public CSSValue {
+public:
+ // TODO(sashab): Rename this to just create().
rjwright 2016/09/22 06:12:50 How come you don't do this in this patch? Does it
sashab 2016/09/23 01:01:10 I have a style where I like to limit patches to ju
Timothy Loh 2016/09/23 04:06:14 At least for this one you're already renaming from
+ static CSSIdentifierValue* createIdentifier(CSSValueID);
+
+ // TODO(sashab): Rename this to createFromPlatformValue().
rjwright 2016/09/22 06:12:50 Why wait?
sashab 2016/09/23 01:01:10 Same argument as above.
+ 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

Powered by Google App Engine
This is Rietveld 408576698