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