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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 const CSSParserToken& token = range.peek(); | 438 const CSSParserToken& token = range.peek(); |
439 | 439 |
440 if (token.type() == StringToken || token.type() == UrlToken) | 440 if (token.type() == StringToken || token.type() == UrlToken) |
441 return range.consumeIncludingWhitespace().value().toAtomicString(); | 441 return range.consumeIncludingWhitespace().value().toAtomicString(); |
442 | 442 |
443 if (token.type() != FunctionToken || !equalIgnoringASCIICase(token.value(),
"url")) | 443 if (token.type() != FunctionToken || !equalIgnoringASCIICase(token.value(),
"url")) |
444 return AtomicString(); | 444 return AtomicString(); |
445 | 445 |
446 CSSParserTokenRange contents = range.consumeBlock(); | 446 CSSParserTokenRange contents = range.consumeBlock(); |
447 const CSSParserToken& uri = contents.consumeIncludingWhitespace(); | 447 const CSSParserToken& uri = contents.consumeIncludingWhitespace(); |
448 ASSERT(uri.type() == StringToken); | 448 if (uri.type() == BadStringToken || !contents.atEnd()) |
449 if (!contents.atEnd()) | |
450 return AtomicString(); | 449 return AtomicString(); |
| 450 DCHECK_EQ(uri.type(), StringToken); |
451 return uri.value().toAtomicString(); | 451 return uri.value().toAtomicString(); |
452 } | 452 } |
453 | 453 |
454 StyleRuleCharset* CSSParserImpl::consumeCharsetRule(CSSParserTokenRange prelude) | 454 StyleRuleCharset* CSSParserImpl::consumeCharsetRule(CSSParserTokenRange prelude) |
455 { | 455 { |
456 prelude.consumeWhitespace(); | 456 prelude.consumeWhitespace(); |
457 const CSSParserToken& string = prelude.consumeIncludingWhitespace(); | 457 const CSSParserToken& string = prelude.consumeIncludingWhitespace(); |
458 if (string.type() != StringToken || !prelude.atEnd()) | 458 if (string.type() != StringToken || !prelude.atEnd()) |
459 return nullptr; // Parse error, expected a single string | 459 return nullptr; // Parse error, expected a single string |
460 return StyleRuleCharset::create(); | 460 return StyleRuleCharset::create(); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 else | 823 else |
824 return nullptr; // Parser error, invalid value in keyframe selector | 824 return nullptr; // Parser error, invalid value in keyframe selector |
825 if (range.atEnd()) | 825 if (range.atEnd()) |
826 return result; | 826 return result; |
827 if (range.consume().type() != CommaToken) | 827 if (range.consume().type() != CommaToken) |
828 return nullptr; // Parser error | 828 return nullptr; // Parser error |
829 } | 829 } |
830 } | 830 } |
831 | 831 |
832 } // namespace blink | 832 } // namespace blink |
OLD | NEW |