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