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::hasStringBacking() const | |
133 { | |
134 CSSParserTokenType tokenType = type(); | |
135 return tokenType == IdentToken | |
136 || tokenType == FunctionToken | |
137 || tokenType == AtKeywordToken | |
138 || tokenType == HashToken | |
139 || tokenType == UrlToken | |
140 || tokenType == DimensionToken | |
141 || tokenType == StringToken; | |
142 } | |
143 | |
144 CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars
erString) const | |
145 { | |
146 CSSParserToken copy(*this); | |
147 copy.initValueFromCSSParserString(parserString); | |
148 return copy; | |
149 } | |
150 | |
151 void CSSParserToken::serialize(StringBuilder& builder) const | 132 void CSSParserToken::serialize(StringBuilder& builder) const |
152 { | 133 { |
153 // This is currently only used for @supports CSSOM. To keep our implementati
on | 134 // This is currently only used for @supports CSSOM. To keep our implementati
on |
154 // simple we handle some of the edge cases incorrectly (see comments below). | 135 // simple we handle some of the edge cases incorrectly (see comments below). |
155 switch (type()) { | 136 switch (type()) { |
156 case IdentToken: | 137 case IdentToken: |
157 serializeIdentifier(value(), builder); | 138 serializeIdentifier(value(), builder); |
158 break; | 139 break; |
159 case FunctionToken: | 140 case FunctionToken: |
160 serializeIdentifier(value(), builder); | 141 serializeIdentifier(value(), builder); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return builder.append('}'); | 216 return builder.append('}'); |
236 | 217 |
237 case EOFToken: | 218 case EOFToken: |
238 case CommentToken: | 219 case CommentToken: |
239 ASSERT_NOT_REACHED(); | 220 ASSERT_NOT_REACHED(); |
240 return; | 221 return; |
241 } | 222 } |
242 } | 223 } |
243 | 224 |
244 } // namespace blink | 225 } // namespace blink |
OLD | NEW |