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 "core/css/parser/CSSParserImpl.h" | 5 #include "core/css/parser/CSSParserImpl.h" |
6 | 6 |
7 #include "core/css/CSSCustomIdentValue.h" | 7 #include "core/css/CSSCustomIdentValue.h" |
8 #include "core/css/CSSCustomPropertyDeclaration.h" | 8 #include "core/css/CSSCustomPropertyDeclaration.h" |
9 #include "core/css/CSSKeyframesRule.h" | 9 #include "core/css/CSSKeyframesRule.h" |
10 #include "core/css/CSSStyleSheet.h" | 10 #include "core/css/CSSStyleSheet.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 std::bitset<numCSSProperties> seenProperties; | 182 std::bitset<numCSSProperties> seenProperties; |
183 size_t unusedEntries = parser.m_parsedProperties.size(); | 183 size_t unusedEntries = parser.m_parsedProperties.size(); |
184 HeapVector<CSSProperty, 256> results(unusedEntries); | 184 HeapVector<CSSProperty, 256> results(unusedEntries); |
185 HashSet<AtomicString> seenCustomProperties; | 185 HashSet<AtomicString> seenCustomProperties; |
186 filterProperties(true, parser.m_parsedProperties, results, unusedEntries, | 186 filterProperties(true, parser.m_parsedProperties, results, unusedEntries, |
187 seenProperties, seenCustomProperties); | 187 seenProperties, seenCustomProperties); |
188 filterProperties(false, parser.m_parsedProperties, results, unusedEntries, | 188 filterProperties(false, parser.m_parsedProperties, results, unusedEntries, |
189 seenProperties, seenCustomProperties); | 189 seenProperties, seenCustomProperties); |
190 if (unusedEntries) | 190 if (unusedEntries) |
191 results.remove(0, unusedEntries); | 191 results.erase(0, unusedEntries); |
192 return declaration->addParsedProperties(results); | 192 return declaration->addParsedProperties(results); |
193 } | 193 } |
194 | 194 |
195 StyleRuleBase* CSSParserImpl::parseRule(const String& string, | 195 StyleRuleBase* CSSParserImpl::parseRule(const String& string, |
196 const CSSParserContext* context, | 196 const CSSParserContext* context, |
197 StyleSheetContents* styleSheet, | 197 StyleSheetContents* styleSheet, |
198 AllowedRulesType allowedRules) { | 198 AllowedRulesType allowedRules) { |
199 CSSParserImpl parser(context, styleSheet); | 199 CSSParserImpl parser(context, styleSheet); |
200 CSSTokenizer tokenizer(string); | 200 CSSTokenizer tokenizer(string); |
201 CSSParserTokenRange range = tokenizer.tokenRange(); | 201 CSSParserTokenRange range = tokenizer.tokenRange(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 range.consumeWhitespace(); | 309 range.consumeWhitespace(); |
310 if (!range.atEnd()) | 310 if (!range.atEnd()) |
311 return nullptr; | 311 return nullptr; |
312 CSSParserImpl parser(strictCSSParserContext()); | 312 CSSParserImpl parser(strictCSSParserContext()); |
313 parser.consumeDeclarationList(block, StyleRule::Style); | 313 parser.consumeDeclarationList(block, StyleRule::Style); |
314 | 314 |
315 // Drop nested @apply rules. Seems nicer to do this here instead of making | 315 // Drop nested @apply rules. Seems nicer to do this here instead of making |
316 // a different StyleRule type | 316 // a different StyleRule type |
317 for (size_t i = parser.m_parsedProperties.size(); i--;) { | 317 for (size_t i = parser.m_parsedProperties.size(); i--;) { |
318 if (parser.m_parsedProperties[i].id() == CSSPropertyApplyAtRule) | 318 if (parser.m_parsedProperties[i].id() == CSSPropertyApplyAtRule) |
319 parser.m_parsedProperties.remove(i); | 319 parser.m_parsedProperties.erase(i); |
320 } | 320 } |
321 | 321 |
322 return createStylePropertySet(parser.m_parsedProperties, HTMLStandardMode); | 322 return createStylePropertySet(parser.m_parsedProperties, HTMLStandardMode); |
323 } | 323 } |
324 | 324 |
325 std::unique_ptr<Vector<double>> CSSParserImpl::parseKeyframeKeyList( | 325 std::unique_ptr<Vector<double>> CSSParserImpl::parseKeyframeKeyList( |
326 const String& keyList) { | 326 const String& keyList) { |
327 return consumeKeyframeKeyList(CSSTokenizer(keyList).tokenRange()); | 327 return consumeKeyframeKeyList(CSSTokenizer(keyList).tokenRange()); |
328 } | 328 } |
329 | 329 |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 else | 981 else |
982 return nullptr; // Parser error, invalid value in keyframe selector | 982 return nullptr; // Parser error, invalid value in keyframe selector |
983 if (range.atEnd()) | 983 if (range.atEnd()) |
984 return result; | 984 return result; |
985 if (range.consume().type() != CommaToken) | 985 if (range.consume().type() != CommaToken) |
986 return nullptr; // Parser error | 986 return nullptr; // Parser error |
987 } | 987 } |
988 } | 988 } |
989 | 989 |
990 } // namespace blink | 990 } // namespace blink |
OLD | NEW |