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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 CSSParserToken(CSSParserTokenType, BlockType = NotBlock); | 76 CSSParserToken(CSSParserTokenType, BlockType = NotBlock); |
77 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock); | 77 CSSParserToken(CSSParserTokenType, CSSParserString, BlockType = NotBlock); |
78 | 78 |
79 CSSParserToken(CSSParserTokenType, UChar); // for DelimiterToken | 79 CSSParserToken(CSSParserTokenType, UChar); // for DelimiterToken |
80 CSSParserToken(CSSParserTokenType, double, NumericValueType, NumericSign); /
/ for NumberToken | 80 CSSParserToken(CSSParserTokenType, double, NumericValueType, NumericSign); /
/ for NumberToken |
81 CSSParserToken(CSSParserTokenType, UChar32, UChar32); // for UnicodeRangeTok
en | 81 CSSParserToken(CSSParserTokenType, UChar32, UChar32); // for UnicodeRangeTok
en |
82 | 82 |
83 CSSParserToken(HashTokenType, CSSParserString); | 83 CSSParserToken(HashTokenType, CSSParserString); |
84 | 84 |
85 bool operator==(const CSSParserToken& other) const; | 85 bool operator==(const CSSParserToken& other) const; |
| 86 bool operator!=(const CSSParserToken& other) const { return !(*this == other
); } |
86 | 87 |
87 // Converts NumberToken to DimensionToken. | 88 // Converts NumberToken to DimensionToken. |
88 void convertToDimensionWithUnit(CSSParserString); | 89 void convertToDimensionWithUnit(CSSParserString); |
89 | 90 |
90 // Converts NumberToken to PercentageToken. | 91 // Converts NumberToken to PercentageToken. |
91 void convertToPercentage(); | 92 void convertToPercentage(); |
92 | 93 |
93 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t
ype); } | 94 CSSParserTokenType type() const { return static_cast<CSSParserTokenType>(m_t
ype); } |
94 CSSParserString value() const | 95 CSSParserString value() const |
95 { | 96 { |
(...skipping 30 matching lines...) Expand all Loading... |
126 m_valueLength = value.m_length; | 127 m_valueLength = value.m_length; |
127 m_valueIs8Bit = value.m_is8Bit; | 128 m_valueIs8Bit = value.m_is8Bit; |
128 m_valueDataCharRaw = value.m_data.charactersRaw; | 129 m_valueDataCharRaw = value.m_data.charactersRaw; |
129 } | 130 } |
130 unsigned m_type : 6; // CSSParserTokenType | 131 unsigned m_type : 6; // CSSParserTokenType |
131 unsigned m_blockType : 2; // BlockType | 132 unsigned m_blockType : 2; // BlockType |
132 unsigned m_numericValueType : 1; // NumericValueType | 133 unsigned m_numericValueType : 1; // NumericValueType |
133 unsigned m_numericSign : 2; // NumericSign | 134 unsigned m_numericSign : 2; // NumericSign |
134 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType | 135 unsigned m_unit : 7; // CSSPrimitiveValue::UnitType |
135 | 136 |
| 137 bool valueDataCharRawEqual(const CSSParserToken& other) const; |
| 138 |
136 // m_value... is an unpacked CSSParserString so that we can pack it | 139 // m_value... is an unpacked CSSParserString so that we can pack it |
137 // tightly with the rest of this object for a smaller object size. | 140 // tightly with the rest of this object for a smaller object size. |
138 bool m_valueIs8Bit : 1; | 141 bool m_valueIs8Bit : 1; |
139 unsigned m_valueLength; | 142 unsigned m_valueLength; |
140 const void* m_valueDataCharRaw; // Either LChar* or UChar*. | 143 const void* m_valueDataCharRaw; // Either LChar* or UChar*. |
141 | 144 |
142 union { | 145 union { |
143 UChar m_delimiter; | 146 UChar m_delimiter; |
144 HashTokenType m_hashTokenType; | 147 HashTokenType m_hashTokenType; |
145 double m_numericValue; | 148 double m_numericValue; |
(...skipping 10 matching lines...) Expand all Loading... |
156 | 159 |
157 namespace WTF { | 160 namespace WTF { |
158 template <> | 161 template <> |
159 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { | 162 struct IsTriviallyMoveAssignable<blink::CSSParserToken> { |
160 STATIC_ONLY(IsTriviallyMoveAssignable); | 163 STATIC_ONLY(IsTriviallyMoveAssignable); |
161 static const bool value = true; | 164 static const bool value = true; |
162 }; | 165 }; |
163 } | 166 } |
164 | 167 |
165 #endif // CSSSParserToken_h | 168 #endif // CSSSParserToken_h |
OLD | NEW |