OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CSSCustomIdentValue_h | 5 #ifndef CSSCustomIdentValue_h |
6 #define CSSCustomIdentValue_h | 6 #define CSSCustomIdentValue_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/css/CSSValue.h" | 9 #include "core/css/CSSValue.h" |
10 #include "wtf/text/AtomicString.h" | 10 #include "wtf/text/AtomicString.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CSSCustomIdentValue : public CSSValue { | 14 class CSSCustomIdentValue : public CSSValue { |
15 public: | 15 public: |
16 static CSSCustomIdentValue* create(const AtomicString& str) { | 16 static CSSCustomIdentValue* create(const AtomicString& str) { |
17 return new CSSCustomIdentValue(str); | 17 return new CSSCustomIdentValue(str); |
18 } | 18 } |
19 | 19 |
20 // TODO(sashab, timloh): Remove this and lazily parse the CSSPropertyID in isK
nownPropertyID(). | 20 // TODO(sashab, timloh): Remove this and lazily parse the CSSPropertyID in |
| 21 // isKnownPropertyID(). |
21 static CSSCustomIdentValue* create(CSSPropertyID id) { | 22 static CSSCustomIdentValue* create(CSSPropertyID id) { |
22 return new CSSCustomIdentValue(id); | 23 return new CSSCustomIdentValue(id); |
23 } | 24 } |
24 | 25 |
25 AtomicString value() const { | 26 AtomicString value() const { |
26 DCHECK(!isKnownPropertyID()); | 27 DCHECK(!isKnownPropertyID()); |
27 return m_string; | 28 return m_string; |
28 } | 29 } |
29 bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; } | 30 bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; } |
30 CSSPropertyID valueAsPropertyID() const { | 31 CSSPropertyID valueAsPropertyID() const { |
(...skipping 16 matching lines...) Expand all Loading... |
47 | 48 |
48 AtomicString m_string; | 49 AtomicString m_string; |
49 CSSPropertyID m_propertyId; | 50 CSSPropertyID m_propertyId; |
50 }; | 51 }; |
51 | 52 |
52 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); | 53 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); |
53 | 54 |
54 } // namespace blink | 55 } // namespace blink |
55 | 56 |
56 #endif // CSSCustomIdentValue_h | 57 #endif // CSSCustomIdentValue_h |
OLD | NEW |