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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
685 } | 686 } |
686 } | 687 } |
687 | 688 |
688 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRule::Typ e ruleType) | 689 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRule::Typ e ruleType) |
689 { | 690 { |
690 CSSParserTokenRange rangeCopy = range; // For inspector callbacks | 691 CSSParserTokenRange rangeCopy = range; // For inspector callbacks |
691 | 692 |
692 ASSERT(range.peek().type() == IdentToken); | 693 ASSERT(range.peek().type() == IdentToken); |
693 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 694 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
694 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); | 695 CSSPropertyID unresolvedProperty = token.parseAsUnresolvedCSSPropertyID(); |
696 if (m_styleSheet && m_styleSheet->singleOwnerDocument() && unresolvedPropert y != CSSPropertyInvalid) | |
Timothy Loh
2016/01/25 04:48:41
Probably better to put this at the bottom of the f
nainar
2016/01/25 05:33:22
Done
| |
697 Deprecation::showConsoleWarning(m_styleSheet->singleOwnerDocument()->fra me(), unresolvedProperty); | |
Timothy Loh
2016/01/25 04:48:41
I don't like the naming, this sounds like we're sh
nainar
2016/01/25 05:33:21
Done
| |
695 if (range.consume().type() != ColonToken) | 698 if (range.consume().type() != ColonToken) |
696 return; // Parse error | 699 return; // Parse error |
697 | 700 |
698 bool important = false; | 701 bool important = false; |
699 const CSSParserToken* declarationValueEnd = range.end(); | 702 const CSSParserToken* declarationValueEnd = range.end(); |
700 const CSSParserToken* last = range.end() - 1; | 703 const CSSParserToken* last = range.end() - 1; |
701 while (last->type() == WhitespaceToken) | 704 while (last->type() == WhitespaceToken) |
702 --last; | 705 --last; |
703 if (last->type() == IdentToken && last->valueEqualsIgnoringCase("important") ) { | 706 if (last->type() == IdentToken && last->valueEqualsIgnoringCase("important") ) { |
704 --last; | 707 --last; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 else | 758 else |
756 return nullptr; // Parser error, invalid value in keyframe selector | 759 return nullptr; // Parser error, invalid value in keyframe selector |
757 if (range.atEnd()) | 760 if (range.atEnd()) |
758 return result.release(); | 761 return result.release(); |
759 if (range.consume().type() != CommaToken) | 762 if (range.consume().type() != CommaToken) |
760 return nullptr; // Parser error | 763 return nullptr; // Parser error |
761 } | 764 } |
762 } | 765 } |
763 | 766 |
764 } // namespace blink | 767 } // namespace blink |
OLD | NEW |