| 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 // CSSIdentifierValue stores CSS value keywords, e.g. 'none', 'auto', 'lower-rom
an'. |
| 15 // TODO(sashab): Rename this class to CSSKeywordValue once it no longer conflict
s |
| 16 // with CSSOM's CSSKeywordValue class. |
| 17 class CORE_EXPORT CSSIdentifierValue : public CSSValue { |
| 18 public: |
| 19 static CSSIdentifierValue* create(CSSValueID); |
| 20 |
| 21 // TODO(sashab): Rename this to createFromPlatformValue(). |
| 22 template <typename T> |
| 23 static CSSIdentifierValue* create(T value) { |
| 24 static_assert(!std::is_same<T, CSSValueID>::value, |
| 25 "Do not call create() with a CSSValueID; call " |
| 26 "createIdentifier() instead"); |
| 27 return new CSSIdentifierValue(value); |
| 28 } |
| 29 |
| 30 static CSSIdentifierValue* create(const Length& value) { |
| 31 return new CSSIdentifierValue(value); |
| 32 } |
| 33 |
| 34 CSSValueID getValueID() const { return m_valueID; } |
| 35 |
| 36 String customCSSText() const; |
| 37 |
| 38 bool equals(const CSSIdentifierValue& other) const { |
| 39 return m_valueID == other.m_valueID; |
| 40 } |
| 41 |
| 42 template <typename T> |
| 43 inline T convertTo() const; // Defined in CSSPrimitiveValueMappings.h |
| 44 |
| 45 DECLARE_TRACE_AFTER_DISPATCH(); |
| 46 |
| 47 private: |
| 48 explicit CSSIdentifierValue(CSSValueID); |
| 49 |
| 50 // TODO(sashab): Remove this function, and update mapping methods to specializ
e |
| 51 // the create() method instead. |
| 52 template <typename T> |
| 53 CSSIdentifierValue(T); // Defined in CSSPrimitiveValueMappings.h |
| 54 |
| 55 CSSIdentifierValue(const Length&); |
| 56 |
| 57 CSSValueID m_valueID; |
| 58 }; |
| 59 |
| 60 DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue()); |
| 61 |
| 62 } // namespace blink |
| 63 |
| 64 #endif // CSSIdentifierValue_h |
| OLD | NEW |