OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CSSParserToken_h | 5 #ifndef CSSParserToken_h |
6 #define CSSParserToken_h | 6 #define CSSParserToken_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/css/CSSPrimitiveValue.h" | 9 #include "core/css/CSSPrimitiveValue.h" |
10 #include "core/css/parser/CSSParserString.h" | 10 #include "core/css/parser/CSSParserString.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 UChar delimiter() const; | 100 UChar delimiter() const; |
101 NumericSign numericSign() const; | 101 NumericSign numericSign() const; |
102 NumericValueType numericValueType() const; | 102 NumericValueType numericValueType() const; |
103 double numericValue() const; | 103 double numericValue() const; |
104 HashTokenType hashTokenType() const { ASSERT(m_type == HashToken); return m_
hashTokenType; } | 104 HashTokenType hashTokenType() const { ASSERT(m_type == HashToken); return m_
hashTokenType; } |
105 BlockType blockType() const { return static_cast<BlockType>(m_blockType); } | 105 BlockType blockType() const { return static_cast<BlockType>(m_blockType); } |
106 CSSPrimitiveValue::UnitType unitType() const { return static_cast<CSSPrimiti
veValue::UnitType>(m_unit); } | 106 CSSPrimitiveValue::UnitType unitType() const { return static_cast<CSSPrimiti
veValue::UnitType>(m_unit); } |
107 UChar32 unicodeRangeStart() const { ASSERT(m_type == UnicodeRangeToken); ret
urn m_unicodeRange.start; } | 107 UChar32 unicodeRangeStart() const { ASSERT(m_type == UnicodeRangeToken); ret
urn m_unicodeRange.start; } |
108 UChar32 unicodeRangeEnd() const { ASSERT(m_type == UnicodeRangeToken); retur
n m_unicodeRange.end; } | 108 UChar32 unicodeRangeEnd() const { ASSERT(m_type == UnicodeRangeToken); retur
n m_unicodeRange.end; } |
| 109 CSSValueID id() const; |
| 110 CSSValueID functionId() const; |
109 | 111 |
110 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; | 112 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; |
111 | 113 |
112 void serialize(StringBuilder&) const; | 114 void serialize(StringBuilder&) const; |
113 | 115 |
114 private: | 116 private: |
115 void initValueFromCSSParserString(const CSSParserString& value) | 117 void initValueFromCSSParserString(const CSSParserString& value) |
116 { | 118 { |
117 m_valueLength = value.m_length; | 119 m_valueLength = value.m_length; |
118 m_valueIs8Bit = value.m_is8Bit; | 120 m_valueIs8Bit = value.m_is8Bit; |
119 m_valueDataCharRaw = value.m_data.charactersRaw; | 121 m_valueDataCharRaw = value.m_data.charactersRaw; |
120 } | 122 } |
121 unsigned m_type : 6; // CSSParserTokenType | 123 unsigned m_type : 6; // CSSParserTokenType |
122 unsigned m_blockType : 2; // BlockType | 124 unsigned m_blockType : 2; // BlockType |
123 unsigned m_numericValueType : 1; // NumericValueType | 125 unsigned m_numericValueType : 1; // NumericValueType |
124 unsigned m_numericSign : 2; // NumericSign | 126 unsigned m_numericSign : 2; // NumericSign |
125 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType | 127 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType |
126 | 128 |
127 // m_value... is an unpacked CSSParserString so that we can pack it | 129 // m_value... is an unpacked CSSParserString so that we can pack it |
128 // tightly with the rest of this object for a smaller object size. | 130 // tightly with the rest of this object for a smaller object size. |
129 bool m_valueIs8Bit : 1; | 131 bool m_valueIs8Bit : 1; |
130 unsigned m_valueLength; | 132 unsigned m_valueLength; |
131 const void* m_valueDataCharRaw; // Either LChar* or UChar*. | 133 const void* m_valueDataCharRaw; // Either LChar* or UChar*. |
132 | 134 |
133 union { | 135 union { |
134 UChar m_delimiter; | 136 UChar m_delimiter; |
135 HashTokenType m_hashTokenType; | 137 HashTokenType m_hashTokenType; |
136 double m_numericValue; | 138 double m_numericValue; |
| 139 mutable int m_id; |
137 | 140 |
138 struct { | 141 struct { |
139 UChar32 start; | 142 UChar32 start; |
140 UChar32 end; | 143 UChar32 end; |
141 } m_unicodeRange; | 144 } m_unicodeRange; |
142 }; | 145 }; |
143 }; | 146 }; |
144 | 147 |
145 } // namespace blink | 148 } // namespace blink |
146 | 149 |
147 namespace WTF { | 150 namespace WTF { |
148 template <> | 151 template <> |
149 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { | 152 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { |
150 STATIC_ONLY(IsTriviallyMoveAssignable); | 153 STATIC_ONLY(IsTriviallyMoveAssignable); |
151 static const bool value = true; | 154 static const bool value = true; |
152 }; | 155 }; |
153 } | 156 } |
154 | 157 |
155 #endif // CSSSParserToken_h | 158 #endif // CSSSParserToken_h |
OLD | NEW |