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 "core/css/parser/CSSTokenizer.h" | |
13 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
14 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
15 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 class CSSParserObserver; | 20 class CSSParserObserver; |
20 class CSSParserObserverWrapper; | 21 class CSSParserObserverWrapper; |
21 class StyleRule; | 22 class StyleRule; |
22 class StyleRuleBase; | 23 class StyleRuleBase; |
23 class StyleRuleCharset; | 24 class StyleRuleCharset; |
24 class StyleRuleFontFace; | 25 class StyleRuleFontFace; |
25 class StyleRuleImport; | 26 class StyleRuleImport; |
26 class StyleRuleKeyframe; | 27 class StyleRuleKeyframe; |
27 class StyleRuleKeyframes; | 28 class StyleRuleKeyframes; |
28 class StyleRuleMedia; | 29 class StyleRuleMedia; |
29 class StyleRuleNamespace; | 30 class StyleRuleNamespace; |
30 class StyleRulePage; | 31 class StyleRulePage; |
31 class StyleRuleSupports; | 32 class StyleRuleSupports; |
32 class StyleRuleViewport; | 33 class StyleRuleViewport; |
33 class StyleSheetContents; | 34 class StyleSheetContents; |
34 class ImmutableStylePropertySet; | 35 class ImmutableStylePropertySet; |
35 class Element; | 36 class Element; |
36 class MutableStylePropertySet; | 37 class MutableStylePropertySet; |
37 | 38 |
38 class CSSParserImpl { | 39 class CSSParserImpl { |
39 STACK_ALLOCATED(); | 40 STACK_ALLOCATED(); |
40 public: | 41 public: |
41 CSSParserImpl(const CSSParserContext&, StyleSheetContents* = nullptr); | 42 CSSParserImpl(const CSSParserContext&, const String&, StyleSheetContents* = nullptr); |
42 | 43 |
43 enum AllowedRulesType { | 44 enum AllowedRulesType { |
44 // As per css-syntax, css-cascade and css-namespaces, @charset rules | 45 // As per css-syntax, css-cascade and css-namespaces, @charset rules |
45 // must come first, followed by @import then @namespace. | 46 // must come first, followed by @import then @namespace. |
46 // AllowImportRules actually means we allow @import and any rules thay | 47 // AllowImportRules actually means we allow @import and any rules thay |
47 // may follow it, i.e. @namespace rules and regular rules. | 48 // may follow it, i.e. @namespace rules and regular rules. |
48 // AllowCharsetRules and AllowNamespaceRules behave similarly. | 49 // AllowCharsetRules and AllowNamespaceRules behave similarly. |
49 AllowCharsetRules, | 50 AllowCharsetRules, |
50 AllowImportRules, | 51 AllowImportRules, |
51 AllowNamespaceRules, | 52 AllowNamespaceRules, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken Range prelude, CSSParserTokenRange block); | 92 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken Range prelude, CSSParserTokenRange block); |
92 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP refixed, CSSParserTokenRange prelude, CSSParserTokenRange block); | 93 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP refixed, CSSParserTokenRange prelude, CSSParserTokenRange block); |
93 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr elude, CSSParserTokenRange block); | 94 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr elude, CSSParserTokenRange block); |
94 | 95 |
95 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser TokenRange prelude, CSSParserTokenRange block); | 96 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser TokenRange prelude, CSSParserTokenRange block); |
96 PassRefPtrWillBeRawPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelu de, CSSParserTokenRange block); | 97 PassRefPtrWillBeRawPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelu de, CSSParserTokenRange block); |
97 | 98 |
98 void consumeDeclarationList(CSSParserTokenRange, StyleRule::Type); | 99 void consumeDeclarationList(CSSParserTokenRange, StyleRule::Type); |
99 void consumeDeclaration(CSSParserTokenRange, StyleRule::Type); | 100 void consumeDeclaration(CSSParserTokenRange, StyleRule::Type); |
100 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, StyleRule::Type); | 101 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, StyleRule::Type); |
102 void consumeVariableDeclarationValue(CSSParserTokenRange, const AtomicString & variableName); | |
101 | 103 |
102 static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange ); | 104 static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange ); |
103 | 105 |
104 // FIXME: Can we build StylePropertySets directly? | 106 // FIXME: Can we build StylePropertySets directly? |
105 // FIXME: Investigate using a smaller inline buffer | 107 // FIXME: Investigate using a smaller inline buffer |
106 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; | 108 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; |
107 CSSParserContext m_context; | 109 CSSParserContext m_context; |
108 | 110 |
109 AtomicString m_defaultNamespace; | 111 AtomicString m_defaultNamespace; |
110 RawPtrWillBeMember<StyleSheetContents> m_styleSheet; | 112 RawPtrWillBeMember<StyleSheetContents> m_styleSheet; |
111 | 113 |
112 // For the inspector | 114 // For the inspector |
113 CSSParserObserverWrapper* m_observerWrapper; | 115 CSSParserObserverWrapper* m_observerWrapper; |
116 | |
117 const String& m_baseString; | |
118 AtomicString m_variableName; | |
Timothy Loh
2015/07/23 08:11:47
unused?
| |
114 }; | 119 }; |
115 | 120 |
116 } // namespace blink | 121 } // namespace blink |
117 | 122 |
118 #endif // CSSParserImpl_h | 123 #endif // CSSParserImpl_h |
OLD | NEW |