Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CSSIdentifierValue_h | |
| 6 #define CSSIdentifierValue_h | |
| 7 | |
| 8 #include "core/CSSValueKeywords.h" | |
| 9 #include "core/css/CSSValue.h" | |
| 10 #include "wtf/TypeTraits.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class CORE_EXPORT CSSIdentifierValue : public CSSValue { | |
| 15 public: | |
| 16 // 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
| |
| 17 static CSSIdentifierValue* createIdentifier(CSSValueID); | |
| 18 | |
| 19 // 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.
| |
| 20 template<typename T> static CSSIdentifierValue* create(T value) | |
| 21 { | |
| 22 static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead"); | |
| 23 return new CSSIdentifierValue(value); | |
| 24 } | |
| 25 | |
| 26 static CSSIdentifierValue* create(const Length& value) | |
| 27 { | |
| 28 return new CSSIdentifierValue(value); | |
| 29 } | |
| 30 | |
| 31 CSSValueID getValueID() const { return m_valueID; } | |
| 32 | |
| 33 String customCSSText() const; | |
| 34 | |
| 35 bool equals(const CSSIdentifierValue& other) const | |
| 36 { | |
| 37 return m_valueID == other.m_valueID; | |
| 38 } | |
| 39 | |
| 40 template<typename T> inline T convertTo() const; // Defined in CSSPrimitiveV alueMappings.h | |
| 41 | |
| 42 DECLARE_TRACE_AFTER_DISPATCH(); | |
| 43 | |
| 44 private: | |
| 45 explicit CSSIdentifierValue(CSSValueID); | |
| 46 | |
| 47 // TODO(sashab): Remove this function, and update mapping methods to special ize | |
| 48 // the create() method instead. | |
| 49 template<typename T> CSSIdentifierValue(T); // Defined in CSSPrimitiveValueM appings.h | |
| 50 | |
| 51 CSSIdentifierValue(const Length&); | |
| 52 | |
| 53 CSSValueID m_valueID; | |
| 54 }; | |
| 55 | |
| 56 DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue()); | |
| 57 | |
| 58 } // namespace blink | |
| 59 | |
| 60 #endif // CSSIdentifierValue_h | |
| OLD | NEW |