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 #ifndef CSSParserImpl_h | 5 #ifndef CSSParserImpl_h |
6 #define CSSParserImpl_h | 6 #define CSSParserImpl_h |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/css/CSSProperty.h" | 9 #include "core/css/CSSProperty.h" |
10 #include "core/css/CSSPropertySourceData.h" | 10 #include "core/css/CSSPropertySourceData.h" |
11 #include "core/css/parser/CSSParserMode.h" | 11 #include "core/css/parser/CSSParserMode.h" |
12 #include "core/css/parser/CSSParserTokenRange.h" | 12 #include "core/css/parser/CSSParserTokenRange.h" |
13 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
15 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class StyleRule; | 19 class StyleRule; |
20 class StyleRuleBase; | 20 class StyleRuleBase; |
| 21 class StyleRuleCharset; |
21 class StyleRuleFontFace; | 22 class StyleRuleFontFace; |
22 class StyleRuleImport; | 23 class StyleRuleImport; |
23 class StyleRuleKeyframe; | 24 class StyleRuleKeyframe; |
24 class StyleRuleKeyframes; | 25 class StyleRuleKeyframes; |
25 class StyleRuleMedia; | 26 class StyleRuleMedia; |
26 class StyleRuleNamespace; | 27 class StyleRuleNamespace; |
27 class StyleRulePage; | 28 class StyleRulePage; |
28 class StyleRuleSupports; | 29 class StyleRuleSupports; |
29 class StyleRuleViewport; | 30 class StyleRuleViewport; |
30 class StyleSheetContents; | 31 class StyleSheetContents; |
(...skipping 29 matching lines...) Expand all Loading... |
60 | 61 |
61 bool supportsDeclaration(CSSParserTokenRange&); | 62 bool supportsDeclaration(CSSParserTokenRange&); |
62 | 63 |
63 private: | 64 private: |
64 enum RuleListType { | 65 enum RuleListType { |
65 TopLevelRuleList, | 66 TopLevelRuleList, |
66 RegularRuleList, | 67 RegularRuleList, |
67 KeyframesRuleList | 68 KeyframesRuleList |
68 }; | 69 }; |
69 | 70 |
| 71 // Returns whether the first encountered rule was valid |
70 template<typename T> | 72 template<typename T> |
71 void consumeRuleList(CSSParserTokenRange, RuleListType, T callback); | 73 bool consumeRuleList(CSSParserTokenRange, RuleListType, T callback); |
72 | 74 |
73 // These two functions update the range they're given | 75 // These two functions update the range they're given |
74 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeAtRule(CSSParserTokenRange&, Al
lowedRulesType); | 76 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeAtRule(CSSParserTokenRange&, Al
lowedRulesType); |
75 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeQualifiedRule(CSSParserTokenRan
ge&, AllowedRulesType); | 77 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeQualifiedRule(CSSParserTokenRan
ge&, AllowedRulesType); |
76 | 78 |
| 79 static PassRefPtrWillBeRawPtr<StyleRuleCharset> consumeCharsetRule(CSSParser
TokenRange prelude); |
77 PassRefPtrWillBeRawPtr<StyleRuleImport> consumeImportRule(CSSParserTokenRang
e prelude); | 80 PassRefPtrWillBeRawPtr<StyleRuleImport> consumeImportRule(CSSParserTokenRang
e prelude); |
78 PassRefPtrWillBeRawPtr<StyleRuleNamespace> consumeNamespaceRule(CSSParserTok
enRange prelude); // This can set m_defaultNamespace | 81 PassRefPtrWillBeRawPtr<StyleRuleNamespace> consumeNamespaceRule(CSSParserTok
enRange prelude); // This can set m_defaultNamespace |
79 PassRefPtrWillBeRawPtr<StyleRuleMedia> consumeMediaRule(CSSParserTokenRange
prelude, CSSParserTokenRange block); | 82 PassRefPtrWillBeRawPtr<StyleRuleMedia> consumeMediaRule(CSSParserTokenRange
prelude, CSSParserTokenRange block); |
80 PassRefPtrWillBeRawPtr<StyleRuleSupports> consumeSupportsRule(CSSParserToken
Range prelude, CSSParserTokenRange block); | 83 PassRefPtrWillBeRawPtr<StyleRuleSupports> consumeSupportsRule(CSSParserToken
Range prelude, CSSParserTokenRange block); |
81 PassRefPtrWillBeRawPtr<StyleRuleViewport> consumeViewportRule(CSSParserToken
Range prelude, CSSParserTokenRange block); | 84 PassRefPtrWillBeRawPtr<StyleRuleViewport> consumeViewportRule(CSSParserToken
Range prelude, CSSParserTokenRange block); |
82 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken
Range prelude, CSSParserTokenRange block); | 85 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken
Range prelude, CSSParserTokenRange block); |
83 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP
refixed, CSSParserTokenRange prelude, CSSParserTokenRange block); | 86 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP
refixed, CSSParserTokenRange prelude, CSSParserTokenRange block); |
84 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr
elude, CSSParserTokenRange block); | 87 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr
elude, CSSParserTokenRange block); |
85 | 88 |
86 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser
TokenRange prelude, CSSParserTokenRange block); | 89 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser
TokenRange prelude, CSSParserTokenRange block); |
(...skipping 10 matching lines...) Expand all Loading... |
97 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; | 100 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; |
98 CSSParserContext m_context; | 101 CSSParserContext m_context; |
99 | 102 |
100 AtomicString m_defaultNamespace; | 103 AtomicString m_defaultNamespace; |
101 RawPtrWillBeMember<StyleSheetContents> m_styleSheet; | 104 RawPtrWillBeMember<StyleSheetContents> m_styleSheet; |
102 }; | 105 }; |
103 | 106 |
104 } // namespace blink | 107 } // namespace blink |
105 | 108 |
106 #endif // CSSParserImpl_h | 109 #endif // CSSParserImpl_h |
OLD | NEW |