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 { | |
esprehn
2016/09/30 19:33:07
final ?
| |
18 public: | |
19 static CSSIdentifierValue* create(CSSValueID); | |
20 | |
21 // TODO(sashab): Rename this to createFromPlatformValue(). | |
22 template<typename T> static CSSIdentifierValue* create(T value) | |
23 { | |
24 static_assert(!std::is_same<T, CSSValueID>::value, "Do not call create() with a CSSValueID; call createIdentifier() instead"); | |
25 return new CSSIdentifierValue(value); | |
26 } | |
27 | |
28 static CSSIdentifierValue* create(const Length& value) | |
29 { | |
30 return new CSSIdentifierValue(value); | |
31 } | |
32 | |
33 CSSValueID getValueID() const { return m_valueID; } | |
34 | |
35 String customCSSText() const; | |
36 | |
37 bool equals(const CSSIdentifierValue& other) const | |
38 { | |
39 return m_valueID == other.m_valueID; | |
40 } | |
41 | |
42 template<typename T> inline T convertTo() const; // Defined in CSSPrimitiveV alueMappings.h | |
43 | |
44 DECLARE_TRACE_AFTER_DISPATCH(); | |
45 | |
46 private: | |
47 explicit CSSIdentifierValue(CSSValueID); | |
48 | |
49 // TODO(sashab): Remove this function, and update mapping methods to special ize | |
50 // the create() method instead. | |
51 template<typename T> CSSIdentifierValue(T); // Defined in CSSPrimitiveValueM appings.h | |
52 | |
53 CSSIdentifierValue(const Length&); | |
54 | |
55 CSSValueID m_valueID; | |
56 }; | |
57 | |
58 DEFINE_CSS_VALUE_TYPE_CASTS(CSSIdentifierValue, isIdentifierValue()); | |
59 | |
60 } // namespace blink | |
61 | |
62 #endif // CSSIdentifierValue_h | |
OLD | NEW |