| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CSSIdentifierValue_h | 5 #ifndef CSSIdentifierValue_h |
| 6 #define CSSIdentifierValue_h | 6 #define CSSIdentifierValue_h |
| 7 | 7 |
| 8 #include "core/CSSValueKeywords.h" | 8 #include "core/CSSValueKeywords.h" |
| 9 #include "core/css/CSSValue.h" | 9 #include "core/css/CSSValue.h" |
| 10 #include "wtf/TypeTraits.h" | 10 #include "wtf/TypeTraits.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 // CSSIdentifierValue stores CSS value keywords, e.g. 'none', 'auto', 'lower-rom
an'. | 14 // CSSIdentifierValue stores CSS value keywords, e.g. 'none', 'auto', |
| 15 // TODO(sashab): Rename this class to CSSKeywordValue once it no longer conflict
s | 15 // 'lower-roman'. |
| 16 // with CSSOM's CSSKeywordValue class. | 16 // TODO(sashab): Rename this class to CSSKeywordValue once it no longer |
| 17 // conflicts with CSSOM's CSSKeywordValue class. |
| 17 class CORE_EXPORT CSSIdentifierValue : public CSSValue { | 18 class CORE_EXPORT CSSIdentifierValue : public CSSValue { |
| 18 public: | 19 public: |
| 19 static CSSIdentifierValue* create(CSSValueID); | 20 static CSSIdentifierValue* create(CSSValueID); |
| 20 | 21 |
| 21 // TODO(sashab): Rename this to createFromPlatformValue(). | 22 // TODO(sashab): Rename this to createFromPlatformValue(). |
| 22 template <typename T> | 23 template <typename T> |
| 23 static CSSIdentifierValue* create(T value) { | 24 static CSSIdentifierValue* create(T value) { |
| 24 static_assert(!std::is_same<T, CSSValueID>::value, | 25 static_assert(!std::is_same<T, CSSValueID>::value, |
| 25 "Do not call create() with a CSSValueID; call " | 26 "Do not call create() with a CSSValueID; call " |
| 26 "createIdentifier() instead"); | 27 "createIdentifier() instead"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 } | 41 } |
| 41 | 42 |
| 42 template <typename T> | 43 template <typename T> |
| 43 inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h | 44 inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h |
| 44 | 45 |
| 45 DECLARE_TRACE_AFTER_DISPATCH(); | 46 DECLARE_TRACE_AFTER_DISPATCH(); |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 explicit CSSIdentifierValue(CSSValueID); | 49 explicit CSSIdentifierValue(CSSValueID); |
| 49 | 50 |
| 50 // TODO(sashab): Remove this function, and update mapping methods to specializ
e | 51 // TODO(sashab): Remove this function, and update mapping methods to |
| 51 // the create() method instead. | 52 // specialize the create() method instead. |
| 52 template <typename T> | 53 template <typename T> |
| 53 CSSIdentifierValue(T); // Defined in CSSPrimitiveValueMappings.h | 54 CSSIdentifierValue(T); // Defined in CSSPrimitiveValueMappings.h |
| 54 | 55 |
| 55 CSSIdentifierValue(const Length&); | 56 CSSIdentifierValue(const Length&); |
| 56 | 57 |
| 57 CSSValueID m_valueID; | 58 CSSValueID m_valueID; |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue()); | 61 DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue()); |
| 61 | 62 |
| 62 } // namespace blink | 63 } // namespace blink |
| 63 | 64 |
| 64 #endif // CSSIdentifierValue_h | 65 #endif // CSSIdentifierValue_h |
| OLD | NEW |