| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 433 } |
| 434 | 434 |
| 435 // This may still consume tokens if it fails | 435 // This may still consume tokens if it fails |
| 436 static AtomicString consumeStringOrURI(CSSParserTokenRange& range) | 436 static AtomicString consumeStringOrURI(CSSParserTokenRange& range) |
| 437 { | 437 { |
| 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 || !token.valueEqualsIgnoringASCIICase("ur
l")) | 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 ASSERT(uri.type() == StringToken); |
| 449 if (!contents.atEnd()) | 449 if (!contents.atEnd()) |
| 450 return AtomicString(); | 450 return AtomicString(); |
| 451 return uri.value().toAtomicString(); | 451 return uri.value().toAtomicString(); |
| 452 } | 452 } |
| 453 | 453 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 755 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 756 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); | 756 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); |
| 757 if (range.consume().type() != ColonToken) | 757 if (range.consume().type() != ColonToken) |
| 758 return; // Parse error | 758 return; // Parse error |
| 759 | 759 |
| 760 bool important = false; | 760 bool important = false; |
| 761 const CSSParserToken* declarationValueEnd = range.end(); | 761 const CSSParserToken* declarationValueEnd = range.end(); |
| 762 const CSSParserToken* last = range.end() - 1; | 762 const CSSParserToken* last = range.end() - 1; |
| 763 while (last->type() == WhitespaceToken) | 763 while (last->type() == WhitespaceToken) |
| 764 --last; | 764 --last; |
| 765 if (last->type() == IdentToken && last->valueEqualsIgnoringASCIICase("import
ant")) { | 765 if (last->type() == IdentToken && equalIgnoringASCIICase(last->value(), "imp
ortant")) { |
| 766 --last; | 766 --last; |
| 767 while (last->type() == WhitespaceToken) | 767 while (last->type() == WhitespaceToken) |
| 768 --last; | 768 --last; |
| 769 if (last->type() == DelimiterToken && last->delimiter() == '!') { | 769 if (last->type() == DelimiterToken && last->delimiter() == '!') { |
| 770 important = true; | 770 important = true; |
| 771 declarationValueEnd = last; | 771 declarationValueEnd = last; |
| 772 } | 772 } |
| 773 } | 773 } |
| 774 | 774 |
| 775 size_t propertiesCount = m_parsedProperties.size(); | 775 size_t propertiesCount = m_parsedProperties.size(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 806 } | 806 } |
| 807 | 807 |
| 808 std::unique_ptr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserT
okenRange range) | 808 std::unique_ptr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserT
okenRange range) |
| 809 { | 809 { |
| 810 std::unique_ptr<Vector<double>> result = wrapUnique(new Vector<double>); | 810 std::unique_ptr<Vector<double>> result = wrapUnique(new Vector<double>); |
| 811 while (true) { | 811 while (true) { |
| 812 range.consumeWhitespace(); | 812 range.consumeWhitespace(); |
| 813 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 813 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 814 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) | 814 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) |
| 815 result->append(token.numericValue() / 100); | 815 result->append(token.numericValue() / 100); |
| 816 else if (token.type() == IdentToken && token.valueEqualsIgnoringASCIICas
e("from")) | 816 else if (token.type() == IdentToken && equalIgnoringASCIICase(token.valu
e(), "from")) |
| 817 result->append(0); | 817 result->append(0); |
| 818 else if (token.type() == IdentToken && token.valueEqualsIgnoringASCIICas
e("to")) | 818 else if (token.type() == IdentToken && equalIgnoringASCIICase(token.valu
e(), "to")) |
| 819 result->append(1); | 819 result->append(1); |
| 820 else | 820 else |
| 821 return nullptr; // Parser error, invalid value in keyframe selector | 821 return nullptr; // Parser error, invalid value in keyframe selector |
| 822 if (range.atEnd()) | 822 if (range.atEnd()) |
| 823 return result; | 823 return result; |
| 824 if (range.consume().type() != CommaToken) | 824 if (range.consume().type() != CommaToken) |
| 825 return nullptr; // Parser error | 825 return nullptr; // Parser error |
| 826 } | 826 } |
| 827 } | 827 } |
| 828 | 828 |
| 829 } // namespace blink | 829 } // namespace blink |
| OLD | NEW |