| 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/CSSCustomPropertyDeclaration.h" | 7 #include "core/css/CSSCustomPropertyDeclaration.h" |
| 8 #include "core/css/CSSKeyframesRule.h" | 8 #include "core/css/CSSKeyframesRule.h" |
| 9 #include "core/css/CSSStyleSheet.h" | 9 #include "core/css/CSSStyleSheet.h" |
| 10 #include "core/css/StylePropertySet.h" | 10 #include "core/css/StylePropertySet.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 // This may still consume tokens if it fails | 353 // This may still consume tokens if it fails |
| 354 static AtomicString consumeStringOrURI(CSSParserTokenRange& range) | 354 static AtomicString consumeStringOrURI(CSSParserTokenRange& range) |
| 355 { | 355 { |
| 356 const CSSParserToken& token = range.peek(); | 356 const CSSParserToken& token = range.peek(); |
| 357 | 357 |
| 358 if (token.type() == StringToken || token.type() == UrlToken) | 358 if (token.type() == StringToken || token.type() == UrlToken) |
| 359 return range.consumeIncludingWhitespace().value(); | 359 return range.consumeIncludingWhitespace().value(); |
| 360 | 360 |
| 361 if (token.type() != FunctionToken || !token.valueEqualsIgnoringCase("url")) | 361 if (token.type() != FunctionToken || !token.valueEqualsIgnoringASCIICase("ur
l")) |
| 362 return AtomicString(); | 362 return AtomicString(); |
| 363 | 363 |
| 364 CSSParserTokenRange contents = range.consumeBlock(); | 364 CSSParserTokenRange contents = range.consumeBlock(); |
| 365 const CSSParserToken& uri = contents.consumeIncludingWhitespace(); | 365 const CSSParserToken& uri = contents.consumeIncludingWhitespace(); |
| 366 ASSERT(uri.type() == StringToken); | 366 ASSERT(uri.type() == StringToken); |
| 367 if (!contents.atEnd()) | 367 if (!contents.atEnd()) |
| 368 return AtomicString(); | 368 return AtomicString(); |
| 369 return uri.value(); | 369 return uri.value(); |
| 370 } | 370 } |
| 371 | 371 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 693 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 694 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); | 694 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); |
| 695 if (range.consume().type() != ColonToken) | 695 if (range.consume().type() != ColonToken) |
| 696 return; // Parse error | 696 return; // Parse error |
| 697 | 697 |
| 698 bool important = false; | 698 bool important = false; |
| 699 const CSSParserToken* declarationValueEnd = range.end(); | 699 const CSSParserToken* declarationValueEnd = range.end(); |
| 700 const CSSParserToken* last = range.end() - 1; | 700 const CSSParserToken* last = range.end() - 1; |
| 701 while (last->type() == WhitespaceToken) | 701 while (last->type() == WhitespaceToken) |
| 702 --last; | 702 --last; |
| 703 if (last->type() == IdentToken && last->valueEqualsIgnoringCase("important")
) { | 703 if (last->type() == IdentToken && last->valueEqualsIgnoringASCIICase("import
ant")) { |
| 704 --last; | 704 --last; |
| 705 while (last->type() == WhitespaceToken) | 705 while (last->type() == WhitespaceToken) |
| 706 --last; | 706 --last; |
| 707 if (last->type() == DelimiterToken && last->delimiter() == '!') { | 707 if (last->type() == DelimiterToken && last->delimiter() == '!') { |
| 708 important = true; | 708 important = true; |
| 709 declarationValueEnd = last; | 709 declarationValueEnd = last; |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 size_t propertiesCount = m_parsedProperties.size(); | 713 size_t propertiesCount = m_parsedProperties.size(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 741 } | 741 } |
| 742 | 742 |
| 743 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR
ange range) | 743 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR
ange range) |
| 744 { | 744 { |
| 745 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); | 745 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); |
| 746 while (true) { | 746 while (true) { |
| 747 range.consumeWhitespace(); | 747 range.consumeWhitespace(); |
| 748 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 748 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 749 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) | 749 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) |
| 750 result->append(token.numericValue() / 100); | 750 result->append(token.numericValue() / 100); |
| 751 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr
om")) | 751 else if (token.type() == IdentToken && token.valueEqualsIgnoringASCIICas
e("from")) |
| 752 result->append(0); | 752 result->append(0); |
| 753 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to
")) | 753 else if (token.type() == IdentToken && token.valueEqualsIgnoringASCIICas
e("to")) |
| 754 result->append(1); | 754 result->append(1); |
| 755 else | 755 else |
| 756 return nullptr; // Parser error, invalid value in keyframe selector | 756 return nullptr; // Parser error, invalid value in keyframe selector |
| 757 if (range.atEnd()) | 757 if (range.atEnd()) |
| 758 return result.release(); | 758 return result.release(); |
| 759 if (range.consume().type() != CommaToken) | 759 if (range.consume().type() != CommaToken) |
| 760 return nullptr; // Parser error | 760 return nullptr; // Parser error |
| 761 } | 761 } |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace blink | 764 } // namespace blink |
| OLD | NEW |