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; |
109 | 110 |
110 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; | 111 CSSPropertyID parseAsUnresolvedCSSPropertyID() const; |
111 | 112 |
112 void serialize(StringBuilder&) const; | 113 void serialize(StringBuilder&) const; |
113 | 114 |
114 private: | 115 private: |
115 void initValueFromCSSParserString(const CSSParserString& value) | 116 void initValueFromCSSParserString(const CSSParserString& value) |
116 { | 117 { |
117 m_valueLength = value.m_length; | 118 m_valueLength = value.m_length; |
118 m_valueIs8Bit = value.m_is8Bit; | 119 m_valueIs8Bit = value.m_is8Bit; |
119 m_valueDataCharRaw = value.m_data.charactersRaw; | 120 m_valueDataCharRaw = value.m_data.charactersRaw; |
120 } | 121 } |
121 unsigned m_type : 6; // CSSParserTokenType | 122 unsigned m_type : 6; // CSSParserTokenType |
122 unsigned m_blockType : 2; // BlockType | 123 unsigned m_blockType : 2; // BlockType |
123 unsigned m_numericValueType : 1; // NumericValueType | 124 unsigned m_numericValueType : 1; // NumericValueType |
124 unsigned m_numericSign : 2; // NumericSign | 125 unsigned m_numericSign : 2; // NumericSign |
125 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType | 126 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType |
126 | 127 |
127 // m_value... is an unpacked CSSParserString so that we can pack it | 128 // 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. | 129 // tightly with the rest of this object for a smaller object size. |
129 bool m_valueIs8Bit : 1; | 130 bool m_valueIs8Bit : 1; |
130 unsigned m_valueLength; | 131 unsigned m_valueLength; |
131 const void* m_valueDataCharRaw; // Either LChar* or UChar*. | 132 const void* m_valueDataCharRaw; // Either LChar* or UChar*. |
132 | 133 |
133 union { | 134 union { |
134 UChar m_delimiter; | 135 UChar m_delimiter; |
135 HashTokenType m_hashTokenType; | 136 HashTokenType m_hashTokenType; |
136 double m_numericValue; | 137 double m_numericValue; |
| 138 mutable int m_id; |
137 | 139 |
138 struct { | 140 struct { |
139 UChar32 start; | 141 UChar32 start; |
140 UChar32 end; | 142 UChar32 end; |
141 } m_unicodeRange; | 143 } m_unicodeRange; |
142 }; | 144 }; |
143 }; | 145 }; |
144 | 146 |
145 } // namespace blink | 147 } // namespace blink |
146 | 148 |
147 namespace WTF { | 149 namespace WTF { |
148 template <> | 150 template <> |
149 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { | 151 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { |
150 STATIC_ONLY(IsTriviallyMoveAssignable); | 152 STATIC_ONLY(IsTriviallyMoveAssignable); |
151 static const bool value = true; | 153 static const bool value = true; |
152 }; | 154 }; |
153 } | 155 } |
154 | 156 |
155 #endif // CSSSParserToken_h | 157 #endif // CSSSParserToken_h |
OLD | NEW |