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 #include <memory> | |
17 | 16 |
18 namespace blink { | 17 namespace blink { |
19 | 18 |
20 class CSSParserObserver; | 19 class CSSParserObserver; |
21 class CSSParserObserverWrapper; | 20 class CSSParserObserverWrapper; |
22 class StyleRule; | 21 class StyleRule; |
23 class StyleRuleBase; | 22 class StyleRuleBase; |
24 class StyleRuleCharset; | 23 class StyleRuleCharset; |
25 class StyleRuleFontFace; | 24 class StyleRuleFontFace; |
26 class StyleRuleImport; | 25 class StyleRuleImport; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, const CSSParserContext&); | 59 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, const CSSParserContext&); |
61 static bool parseVariableValue(MutableStylePropertySet*, const AtomicString&
propertyName, const String&, bool important, const CSSParserContext&); | 60 static bool parseVariableValue(MutableStylePropertySet*, const AtomicString&
propertyName, const String&, bool important, const CSSParserContext&); |
62 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&,
Element*); | 61 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&,
Element*); |
63 static bool parseDeclarationList(MutableStylePropertySet*, const String&, co
nst CSSParserContext&); | 62 static bool parseDeclarationList(MutableStylePropertySet*, const String&, co
nst CSSParserContext&); |
64 static StyleRuleBase* parseRule(const String&, const CSSParserContext&, Styl
eSheetContents*, AllowedRulesType); | 63 static StyleRuleBase* parseRule(const String&, const CSSParserContext&, Styl
eSheetContents*, AllowedRulesType); |
65 static void parseStyleSheet(const String&, const CSSParserContext&, StyleShe
etContents*); | 64 static void parseStyleSheet(const String&, const CSSParserContext&, StyleShe
etContents*); |
66 static CSSSelectorList parsePageSelector(CSSParserTokenRange, StyleSheetCont
ents*); | 65 static CSSSelectorList parsePageSelector(CSSParserTokenRange, StyleSheetCont
ents*); |
67 | 66 |
68 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange
); | 67 static ImmutableStylePropertySet* parseCustomPropertySet(CSSParserTokenRange
); |
69 | 68 |
70 static std::unique_ptr<Vector<double>> parseKeyframeKeyList(const String&); | 69 static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); |
71 | 70 |
72 bool supportsDeclaration(CSSParserTokenRange&); | 71 bool supportsDeclaration(CSSParserTokenRange&); |
73 | 72 |
74 static void parseDeclarationListForInspector(const String&, const CSSParserC
ontext&, CSSParserObserver&); | 73 static void parseDeclarationListForInspector(const String&, const CSSParserC
ontext&, CSSParserObserver&); |
75 static void parseStyleSheetForInspector(const String&, const CSSParserContex
t&, StyleSheetContents*, CSSParserObserver&); | 74 static void parseStyleSheetForInspector(const String&, const CSSParserContex
t&, StyleSheetContents*, CSSParserObserver&); |
76 | 75 |
77 private: | 76 private: |
78 enum RuleListType { | 77 enum RuleListType { |
79 TopLevelRuleList, | 78 TopLevelRuleList, |
80 RegularRuleList, | 79 RegularRuleList, |
(...skipping 21 matching lines...) Expand all Loading... |
102 void consumeApplyRule(CSSParserTokenRange prelude); | 101 void consumeApplyRule(CSSParserTokenRange prelude); |
103 | 102 |
104 StyleRuleKeyframe* consumeKeyframeStyleRule(CSSParserTokenRange prelude, CSS
ParserTokenRange block); | 103 StyleRuleKeyframe* consumeKeyframeStyleRule(CSSParserTokenRange prelude, CSS
ParserTokenRange block); |
105 StyleRule* consumeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange
block); | 104 StyleRule* consumeStyleRule(CSSParserTokenRange prelude, CSSParserTokenRange
block); |
106 | 105 |
107 void consumeDeclarationList(CSSParserTokenRange, StyleRule::RuleType); | 106 void consumeDeclarationList(CSSParserTokenRange, StyleRule::RuleType); |
108 void consumeDeclaration(CSSParserTokenRange, StyleRule::RuleType); | 107 void consumeDeclaration(CSSParserTokenRange, StyleRule::RuleType); |
109 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import
ant, StyleRule::RuleType); | 108 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import
ant, StyleRule::RuleType); |
110 void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyN
ame, bool important); | 109 void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyN
ame, bool important); |
111 | 110 |
112 static std::unique_ptr<Vector<double>> consumeKeyframeKeyList(CSSParserToken
Range); | 111 static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange
); |
113 | 112 |
114 // FIXME: Can we build StylePropertySets directly? | 113 // FIXME: Can we build StylePropertySets directly? |
115 // FIXME: Investigate using a smaller inline buffer | 114 // FIXME: Investigate using a smaller inline buffer |
116 HeapVector<CSSProperty, 256> m_parsedProperties; | 115 HeapVector<CSSProperty, 256> m_parsedProperties; |
117 const CSSParserContext& m_context; | 116 const CSSParserContext& m_context; |
118 | 117 |
119 Member<StyleSheetContents> m_styleSheet; | 118 Member<StyleSheetContents> m_styleSheet; |
120 | 119 |
121 // For the inspector | 120 // For the inspector |
122 CSSParserObserverWrapper* m_observerWrapper; | 121 CSSParserObserverWrapper* m_observerWrapper; |
123 }; | 122 }; |
124 | 123 |
125 } // namespace blink | 124 } // namespace blink |
126 | 125 |
127 #endif // CSSParserImpl_h | 126 #endif // CSSParserImpl_h |
OLD | NEW |