| 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" |
| 11 #include "core/css/StyleRuleImport.h" | 11 #include "core/css/StyleRuleImport.h" |
| 12 #include "core/css/StyleRuleKeyframe.h" | 12 #include "core/css/StyleRuleKeyframe.h" |
| 13 #include "core/css/StyleRuleNamespace.h" | 13 #include "core/css/StyleRuleNamespace.h" |
| 14 #include "core/css/StyleSheetContents.h" | 14 #include "core/css/StyleSheetContents.h" |
| 15 #include "core/css/parser/CSSAtRuleID.h" | 15 #include "core/css/parser/CSSAtRuleID.h" |
| 16 #include "core/css/parser/CSSParserObserver.h" | 16 #include "core/css/parser/CSSParserObserver.h" |
| 17 #include "core/css/parser/CSSParserObserverWrapper.h" | 17 #include "core/css/parser/CSSParserObserverWrapper.h" |
| 18 #include "core/css/parser/CSSParserSelector.h" | 18 #include "core/css/parser/CSSParserSelector.h" |
| 19 #include "core/css/parser/CSSPropertyParser.h" | 19 #include "core/css/parser/CSSPropertyParser.h" |
| 20 #include "core/css/parser/CSSSelectorParser.h" | 20 #include "core/css/parser/CSSSelectorParser.h" |
| 21 #include "core/css/parser/CSSSupportsParser.h" | 21 #include "core/css/parser/CSSSupportsParser.h" |
| 22 #include "core/css/parser/CSSTokenizer.h" | 22 #include "core/css/parser/CSSTokenizer.h" |
| 23 #include "core/css/parser/CSSVariableParser.h" | 23 #include "core/css/parser/CSSVariableParser.h" |
| 24 #include "core/css/parser/MediaQueryParser.h" | 24 #include "core/css/parser/MediaQueryParser.h" |
| 25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
| 26 #include "core/dom/Element.h" | 26 #include "core/dom/Element.h" |
| 27 #include "core/frame/Deprecation.h" |
| 27 #include "core/frame/UseCounter.h" | 28 #include "core/frame/UseCounter.h" |
| 28 #include "platform/TraceEvent.h" | 29 #include "platform/TraceEvent.h" |
| 29 #include "wtf/BitArray.h" | 30 #include "wtf/BitArray.h" |
| 30 | 31 |
| 31 namespace blink { | 32 namespace blink { |
| 32 | 33 |
| 33 CSSParserImpl::CSSParserImpl(const CSSParserContext& context, StyleSheetContents
* styleSheet) | 34 CSSParserImpl::CSSParserImpl(const CSSParserContext& context, StyleSheetContents
* styleSheet) |
| 34 : m_context(context) | 35 : m_context(context) |
| 35 , m_styleSheet(styleSheet) | 36 , m_styleSheet(styleSheet) |
| 36 , m_observerWrapper(nullptr) | 37 , m_observerWrapper(nullptr) |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 | 713 |
| 713 size_t propertiesCount = m_parsedProperties.size(); | 714 size_t propertiesCount = m_parsedProperties.size(); |
| 714 if (RuntimeEnabledFeatures::cssVariablesEnabled() && unresolvedProperty == C
SSPropertyInvalid && CSSVariableParser::isValidVariableName(token)) { | 715 if (RuntimeEnabledFeatures::cssVariablesEnabled() && unresolvedProperty == C
SSPropertyInvalid && CSSVariableParser::isValidVariableName(token)) { |
| 715 AtomicString variableName = token.value(); | 716 AtomicString variableName = token.value(); |
| 716 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueE
nd), variableName, important); | 717 consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueE
nd), variableName, important); |
| 717 } | 718 } |
| 718 | 719 |
| 719 if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule::
Keyframe)) | 720 if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule::
Keyframe)) |
| 720 return; | 721 return; |
| 721 | 722 |
| 722 if (unresolvedProperty != CSSPropertyInvalid) | 723 if (unresolvedProperty != CSSPropertyInvalid) { |
| 724 if (m_styleSheet && m_styleSheet->singleOwnerDocument()) |
| 725 Deprecation::warnOnDeprecatedProperties(m_styleSheet->singleOwnerDoc
ument()->frame(), unresolvedProperty); |
| 723 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationVal
ueEnd), unresolvedProperty, important, ruleType); | 726 consumeDeclarationValue(range.makeSubRange(&range.peek(), declarationVal
ueEnd), unresolvedProperty, important, ruleType); |
| 727 } |
| 724 | 728 |
| 725 if (m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleR
ule::Keyframe)) { | 729 if (m_observerWrapper && (ruleType == StyleRule::Style || ruleType == StyleR
ule::Keyframe)) { |
| 726 m_observerWrapper->observer().observeProperty( | 730 m_observerWrapper->observer().observeProperty( |
| 727 m_observerWrapper->startOffset(rangeCopy), m_observerWrapper->endOff
set(rangeCopy), | 731 m_observerWrapper->startOffset(rangeCopy), m_observerWrapper->endOff
set(rangeCopy), |
| 728 important, m_parsedProperties.size() != propertiesCount); | 732 important, m_parsedProperties.size() != propertiesCount); |
| 729 } | 733 } |
| 730 } | 734 } |
| 731 | 735 |
| 732 void CSSParserImpl::consumeVariableValue(CSSParserTokenRange range, const Atomic
String& variableName, bool important) | 736 void CSSParserImpl::consumeVariableValue(CSSParserTokenRange range, const Atomic
String& variableName, bool important) |
| 733 { | 737 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 755 else | 759 else |
| 756 return nullptr; // Parser error, invalid value in keyframe selector | 760 return nullptr; // Parser error, invalid value in keyframe selector |
| 757 if (range.atEnd()) | 761 if (range.atEnd()) |
| 758 return result.release(); | 762 return result.release(); |
| 759 if (range.consume().type() != CommaToken) | 763 if (range.consume().type() != CommaToken) |
| 760 return nullptr; // Parser error | 764 return nullptr; // Parser error |
| 761 } | 765 } |
| 762 } | 766 } |
| 763 | 767 |
| 764 } // namespace blink | 768 } // namespace blink |
| OLD | NEW |