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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 filterProperties(false, parsedProperties, results, unusedEntries, seenProper
ties); | 74 filterProperties(false, parsedProperties, results, unusedEntries, seenProper
ties); |
75 | 75 |
76 RefPtrWillBeRawPtr<ImmutableStylePropertySet> result = ImmutableStylePropert
ySet::create(results.data() + unusedEntries, results.size() - unusedEntries, mod
e); | 76 RefPtrWillBeRawPtr<ImmutableStylePropertySet> result = ImmutableStylePropert
ySet::create(results.data() + unusedEntries, results.size() - unusedEntries, mod
e); |
77 parsedProperties.clear(); | 77 parsedProperties.clear(); |
78 return result.release(); | 78 return result.release(); |
79 } | 79 } |
80 | 80 |
81 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> CSSParserImpl::parseInlineStyl
eDeclaration(const String& string, Element* element) | 81 PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> CSSParserImpl::parseInlineStyl
eDeclaration(const String& string, Element* element) |
82 { | 82 { |
83 Document& document = element->document(); | 83 Document& document = element->document(); |
84 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), document.frame(), UseCounter::getFrom(&document)); | 84 CSSParserContext context = CSSParserContext(document.elementSheet().contents
()->parserContext(), UseCounter::getFrom(&document)); |
85 CSSParserMode mode = element->isHTMLElement() && !document.inQuirksMode() ?
HTMLStandardMode : HTMLQuirksMode; | 85 CSSParserMode mode = element->isHTMLElement() && !document.inQuirksMode() ?
HTMLStandardMode : HTMLQuirksMode; |
86 context.setMode(mode); | 86 context.setMode(mode); |
87 CSSParserImpl parser(context, document.elementSheet().contents()); | 87 CSSParserImpl parser(context, document.elementSheet().contents()); |
88 CSSTokenizer::Scope scope(string); | 88 CSSTokenizer::Scope scope(string); |
89 parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style); | 89 parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style); |
90 return createStylePropertySet(parser.m_parsedProperties, mode); | 90 return createStylePropertySet(parser.m_parsedProperties, mode); |
91 } | 91 } |
92 | 92 |
93 bool CSSParserImpl::parseDeclarationList(MutableStylePropertySet* declaration, c
onst String& string, const CSSParserContext& context) | 93 bool CSSParserImpl::parseDeclarationList(MutableStylePropertySet* declaration, c
onst String& string, const CSSParserContext& context) |
94 { | 94 { |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 else | 729 else |
730 return nullptr; // Parser error, invalid value in keyframe selector | 730 return nullptr; // Parser error, invalid value in keyframe selector |
731 if (range.atEnd()) | 731 if (range.atEnd()) |
732 return result.release(); | 732 return result.release(); |
733 if (range.consume().type() != CommaToken) | 733 if (range.consume().type() != CommaToken) |
734 return nullptr; // Parser error | 734 return nullptr; // Parser error |
735 } | 735 } |
736 } | 736 } |
737 | 737 |
738 } // namespace blink | 738 } // namespace blink |
OLD | NEW |