| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 bool CSSParserImpl::parseValue(MutableStylePropertySet* declaration, | 43 bool CSSParserImpl::parseValue(MutableStylePropertySet* declaration, |
| 44 CSSPropertyID unresolvedProperty, | 44 CSSPropertyID unresolvedProperty, |
| 45 const String& string, | 45 const String& string, |
| 46 bool important, | 46 bool important, |
| 47 const CSSParserContext& context) { | 47 const CSSParserContext& context) { |
| 48 CSSParserImpl parser(context); | 48 CSSParserImpl parser(context); |
| 49 StyleRule::RuleType ruleType = StyleRule::Style; | 49 StyleRule::RuleType ruleType = StyleRule::Style; |
| 50 if (declaration->cssParserMode() == CSSViewportRuleMode) | 50 if (declaration->cssParserMode() == CSSViewportRuleMode) |
| 51 ruleType = StyleRule::Viewport; | 51 ruleType = StyleRule::Viewport; |
| 52 else if (declaration->cssParserMode() == CSSFontFaceRuleMode) |
| 53 ruleType = StyleRule::FontFace; |
| 52 CSSTokenizer::Scope scope(string); | 54 CSSTokenizer::Scope scope(string); |
| 53 parser.consumeDeclarationValue(scope.tokenRange(), unresolvedProperty, | 55 parser.consumeDeclarationValue(scope.tokenRange(), unresolvedProperty, |
| 54 important, ruleType); | 56 important, ruleType); |
| 55 if (parser.m_parsedProperties.isEmpty()) | 57 if (parser.m_parsedProperties.isEmpty()) |
| 56 return false; | 58 return false; |
| 57 return declaration->addParsedProperties(parser.m_parsedProperties); | 59 return declaration->addParsedProperties(parser.m_parsedProperties); |
| 58 } | 60 } |
| 59 | 61 |
| 60 bool CSSParserImpl::parseVariableValue(MutableStylePropertySet* declaration, | 62 bool CSSParserImpl::parseVariableValue(MutableStylePropertySet* declaration, |
| 61 const AtomicString& propertyName, | 63 const AtomicString& propertyName, |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 m_observerWrapper->observer().endRuleHeader(endOffset); | 628 m_observerWrapper->observer().endRuleHeader(endOffset); |
| 627 m_observerWrapper->observer().startRuleBody(endOffset); | 629 m_observerWrapper->observer().startRuleBody(endOffset); |
| 628 m_observerWrapper->observer().endRuleBody(endOffset); | 630 m_observerWrapper->observer().endRuleBody(endOffset); |
| 629 } | 631 } |
| 630 | 632 |
| 631 if (m_styleSheet) | 633 if (m_styleSheet) |
| 632 m_styleSheet->setHasFontFaceRule(); | 634 m_styleSheet->setHasFontFaceRule(); |
| 633 | 635 |
| 634 consumeDeclarationList(block, StyleRule::FontFace); | 636 consumeDeclarationList(block, StyleRule::FontFace); |
| 635 return StyleRuleFontFace::create( | 637 return StyleRuleFontFace::create( |
| 636 createStylePropertySet(m_parsedProperties, m_context.mode())); | 638 createStylePropertySet(m_parsedProperties, CSSFontFaceRuleMode)); |
| 637 } | 639 } |
| 638 | 640 |
| 639 StyleRuleKeyframes* CSSParserImpl::consumeKeyframesRule( | 641 StyleRuleKeyframes* CSSParserImpl::consumeKeyframesRule( |
| 640 bool webkitPrefixed, | 642 bool webkitPrefixed, |
| 641 CSSParserTokenRange prelude, | 643 CSSParserTokenRange prelude, |
| 642 CSSParserTokenRange block) { | 644 CSSParserTokenRange block) { |
| 643 CSSParserTokenRange rangeCopy = prelude; // For inspector callbacks | 645 CSSParserTokenRange rangeCopy = prelude; // For inspector callbacks |
| 644 const CSSParserToken& nameToken = prelude.consumeIncludingWhitespace(); | 646 const CSSParserToken& nameToken = prelude.consumeIncludingWhitespace(); |
| 645 if (!prelude.atEnd()) | 647 if (!prelude.atEnd()) |
| 646 return nullptr; // Parse error; expected single non-whitespace token in @ke
yframes header | 648 return nullptr; // Parse error; expected single non-whitespace token in @ke
yframes header |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 else | 921 else |
| 920 return nullptr; // Parser error, invalid value in keyframe selector | 922 return nullptr; // Parser error, invalid value in keyframe selector |
| 921 if (range.atEnd()) | 923 if (range.atEnd()) |
| 922 return result; | 924 return result; |
| 923 if (range.consume().type() != CommaToken) | 925 if (range.consume().type() != CommaToken) |
| 924 return nullptr; // Parser error | 926 return nullptr; // Parser error |
| 925 } | 927 } |
| 926 } | 928 } |
| 927 | 929 |
| 928 } // namespace blink | 930 } // namespace blink |
| OLD | NEW |