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 #include "config.h" | 5 #include "config.h" |
6 #include "core/css/parser/CSSParserToken.h" | 6 #include "core/css/parser/CSSParserToken.h" |
7 | 7 |
8 #include "core/css/CSSMarkup.h" | 8 #include "core/css/CSSMarkup.h" |
9 #include "core/css/parser/CSSPropertyParser.h" | 9 #include "core/css/parser/CSSPropertyParser.h" |
10 #include "wtf/HashMap.h" | 10 #include "wtf/HashMap.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 122 |
123 CSSValueID CSSParserToken::functionId() const | 123 CSSValueID CSSParserToken::functionId() const |
124 { | 124 { |
125 if (m_type != FunctionToken) | 125 if (m_type != FunctionToken) |
126 return CSSValueInvalid; | 126 return CSSValueInvalid; |
127 if (m_id < 0) | 127 if (m_id < 0) |
128 m_id = cssValueKeywordID(value()); | 128 m_id = cssValueKeywordID(value()); |
129 return static_cast<CSSValueID>(m_id); | 129 return static_cast<CSSValueID>(m_id); |
130 } | 130 } |
131 | 131 |
132 bool CSSParserToken::needsStringBacking() const | |
133 { | |
134 CSSParserTokenType t = type(); | |
Timothy Loh
2015/09/30 02:09:28
t -> tokenType?
| |
135 return t == IdentToken | |
136 || t == FunctionToken | |
137 || t == AtKeywordToken | |
138 || t == HashToken | |
139 || t == UrlToken | |
140 || t == DimensionToken | |
141 || t == StringToken; | |
142 } | |
143 | |
132 void CSSParserToken::serialize(StringBuilder& builder) const | 144 void CSSParserToken::serialize(StringBuilder& builder) const |
133 { | 145 { |
134 // This is currently only used for @supports CSSOM. To keep our implementati on | 146 // This is currently only used for @supports CSSOM. To keep our implementati on |
135 // simple we handle some of the edge cases incorrectly (see comments below). | 147 // simple we handle some of the edge cases incorrectly (see comments below). |
136 switch (type()) { | 148 switch (type()) { |
137 case IdentToken: | 149 case IdentToken: |
138 serializeIdentifier(value(), builder); | 150 serializeIdentifier(value(), builder); |
139 break; | 151 break; |
140 case FunctionToken: | 152 case FunctionToken: |
141 serializeIdentifier(value(), builder); | 153 serializeIdentifier(value(), builder); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 return builder.append('}'); | 228 return builder.append('}'); |
217 | 229 |
218 case EOFToken: | 230 case EOFToken: |
219 case CommentToken: | 231 case CommentToken: |
220 ASSERT_NOT_REACHED(); | 232 ASSERT_NOT_REACHED(); |
221 return; | 233 return; |
222 } | 234 } |
223 } | 235 } |
224 | 236 |
225 } // namespace blink | 237 } // namespace blink |
OLD | NEW |