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/CSSParserImpl.h" | 6 #include "core/css/parser/CSSParserImpl.h" |
7 | 7 |
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 } | 689 } |
690 | 690 |
691 if (unresolvedProperty == CSSPropertyInvalid) | 691 if (unresolvedProperty == CSSPropertyInvalid) |
692 return; | 692 return; |
693 | 693 |
694 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn
d), unresolvedProperty, important, ruleType); | 694 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationValueEn
d), unresolvedProperty, important, ruleType); |
695 } | 695 } |
696 | 696 |
697 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper
tyID unresolvedProperty, bool important, StyleRule::Type ruleType) | 697 void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSProper
tyID unresolvedProperty, bool important, StyleRule::Type ruleType) |
698 { | 698 { |
699 bool usesRemUnits; | 699 CSSParserValueList valueList(range); |
700 CSSParserValueList valueList(range, usesRemUnits); | |
701 if (!valueList.size()) | 700 if (!valueList.size()) |
702 return; // Parser error | 701 return; // Parser error |
| 702 bool usesRemUnits = false; |
| 703 CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, m_c
ontext, m_parsedProperties, ruleType, usesRemUnits); |
703 if (usesRemUnits && m_styleSheet) | 704 if (usesRemUnits && m_styleSheet) |
704 m_styleSheet->parserSetUsesRemUnits(true); | 705 m_styleSheet->parserSetUsesRemUnits(true); |
705 CSSPropertyParser::parseValue(unresolvedProperty, important, &valueList, m_c
ontext, m_parsedProperties, ruleType); | |
706 } | 706 } |
707 | 707 |
708 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR
ange range) | 708 PassOwnPtr<Vector<double>> CSSParserImpl::consumeKeyframeKeyList(CSSParserTokenR
ange range) |
709 { | 709 { |
710 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); | 710 OwnPtr<Vector<double>> result = adoptPtr(new Vector<double>); |
711 while (true) { | 711 while (true) { |
712 range.consumeWhitespace(); | 712 range.consumeWhitespace(); |
713 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 713 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
714 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) | 714 if (token.type() == PercentageToken && token.numericValue() >= 0 && toke
n.numericValue() <= 100) |
715 result->append(token.numericValue() / 100); | 715 result->append(token.numericValue() / 100); |
716 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr
om")) | 716 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("fr
om")) |
717 result->append(0); | 717 result->append(0); |
718 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to
")) | 718 else if (token.type() == IdentToken && token.valueEqualsIgnoringCase("to
")) |
719 result->append(1); | 719 result->append(1); |
720 else | 720 else |
721 return nullptr; // Parser error, invalid value in keyframe selector | 721 return nullptr; // Parser error, invalid value in keyframe selector |
722 if (range.atEnd()) | 722 if (range.atEnd()) |
723 return result.release(); | 723 return result.release(); |
724 if (range.consume().type() != CommaToken) | 724 if (range.consume().type() != CommaToken) |
725 return nullptr; // Parser error | 725 return nullptr; // Parser error |
726 } | 726 } |
727 } | 727 } |
728 | 728 |
729 } // namespace blink | 729 } // namespace blink |
OLD | NEW |