OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CSSStringValues_h | |
6 #define CSSStringValues_h | |
7 | |
8 #include "core/CSSPropertyNames.h" | |
9 #include "core/CoreExport.h" | |
10 #include "core/css/CSSValue.h" | |
11 #include "wtf/PassRefPtr.h" | |
12 #include "wtf/RefCounted.h" | |
13 | |
14 namespace blink { | |
15 | |
16 class CSSStringValue : public CSSValue { | |
17 public: | |
18 static PassRefPtrWillBeRawPtr<CSSStringValue> create(const String& str) | |
19 { | |
20 return adoptRefWillBeNoop(new CSSStringValue(str)); | |
21 } | |
22 | |
23 String value() const { return m_string; } | |
24 String customCSSText() const; | |
25 | |
26 bool equals(const CSSStringValue& other) const { return m_string == other.m_ string; } | |
27 | |
28 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor) ; } | |
29 private: | |
30 CSSStringValue(const String&); | |
31 | |
32 String m_string; | |
33 }; | |
34 | |
35 class CSSCustomIdentValue : public CSSValue { | |
Timothy Loh
2015/09/25 05:44:16
one class per header file
| |
36 public: | |
37 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(const String& str) | |
38 { | |
39 return adoptRefWillBeNoop(new CSSCustomIdentValue(str)); | |
40 } | |
41 | |
42 static PassRefPtrWillBeRawPtr<CSSCustomIdentValue> create(CSSPropertyID prop ertyID) | |
Timothy Loh
2015/09/25 05:44:16
I think this class would look better as:
{
public
sashab
2015/09/28 03:37:03
Changing all the callsites in the parser to pass t
alancutter (OOO until 2018)
2015/09/30 02:08:50
For now we can just use CSSPropertyInvalid to indi
| |
43 { | |
44 return adoptRefWillBeNoop(new CSSCustomIdentValue(propertyID)); | |
45 } | |
46 | |
47 String string() const { ASSERT(!m_isPropertyID); return m_string; } | |
48 CSSPropertyID id() const { ASSERT(m_isPropertyID); return m_id; } | |
49 bool isValidPropertyID() const { return m_isPropertyID; } | |
50 | |
51 String customCSSText() const; | |
52 | |
53 bool equals(const CSSCustomIdentValue& other) const; | |
54 | |
55 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor) ; } | |
56 private: | |
57 CSSCustomIdentValue(const String&); | |
58 CSSCustomIdentValue(CSSPropertyID); | |
59 | |
60 bool m_isPropertyID; | |
61 | |
62 // TODO(sashab): Store these in a union. | |
Timothy Loh
2015/09/25 05:44:16
let's not do this
| |
63 String m_string; | |
64 CSSPropertyID m_id; | |
65 }; | |
66 | |
67 class CSSURIValue : public CSSValue { | |
68 public: | |
69 static PassRefPtrWillBeRawPtr<CSSURIValue> create(const String& str) | |
70 { | |
71 return adoptRefWillBeNoop(new CSSURIValue(str)); | |
72 } | |
73 | |
74 String value() const { return m_string; } | |
75 String customCSSText() const; | |
76 | |
77 bool equals(const CSSURIValue& other) const { return m_string == other.m_str ing; } | |
78 | |
79 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { CSSValue::traceAfterDispatch(visitor) ; } | |
80 private: | |
81 CSSURIValue(const String&); | |
82 | |
83 String m_string; | |
84 }; | |
85 | |
86 DEFINE_CSS_VALUE_TYPE_CASTS(CSSStringValue, isStringValue()); | |
87 DEFINE_CSS_VALUE_TYPE_CASTS(CSSCustomIdentValue, isCustomIdentValue()); | |
88 DEFINE_CSS_VALUE_TYPE_CASTS(CSSURIValue, isURIValue()); | |
89 | |
90 } // namespace blink | |
91 | |
92 #endif // CSSStringValues_h | |
OLD | NEW |