| 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/StylePropertySet.h" |
| 11 #include "core/css/parser/CSSParserMode.h" | 12 #include "core/css/parser/CSSParserMode.h" |
| 12 #include "core/css/parser/CSSParserTokenRange.h" | 13 #include "core/css/parser/CSSParserTokenRange.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 #include <memory> | 17 #include <memory> |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 class CSSLazyParsingState; | 21 class CSSLazyParsingState; |
| 21 class CSSParserObserver; | 22 class CSSParserObserver; |
| 22 class CSSParserObserverWrapper; | 23 class CSSParserObserverWrapper; |
| 23 class StyleRule; | 24 class StyleRule; |
| 24 class StyleRuleBase; | 25 class StyleRuleBase; |
| 25 class StyleRuleCharset; | 26 class StyleRuleCharset; |
| 26 class StyleRuleFontFace; | 27 class StyleRuleFontFace; |
| 27 class StyleRuleImport; | 28 class StyleRuleImport; |
| 28 class StyleRuleKeyframe; | 29 class StyleRuleKeyframe; |
| 29 class StyleRuleKeyframes; | 30 class StyleRuleKeyframes; |
| 30 class StyleRuleMedia; | 31 class StyleRuleMedia; |
| 31 class StyleRuleNamespace; | 32 class StyleRuleNamespace; |
| 32 class StyleRulePage; | 33 class StyleRulePage; |
| 33 class StyleRuleSupports; | 34 class StyleRuleSupports; |
| 34 class StyleRuleViewport; | 35 class StyleRuleViewport; |
| 35 class StyleSheetContents; | 36 class StyleSheetContents; |
| 36 class ImmutableStylePropertySet; | |
| 37 class Element; | 37 class Element; |
| 38 class MutableStylePropertySet; | |
| 39 | 38 |
| 40 class CSSParserImpl { | 39 class CSSParserImpl { |
| 41 STACK_ALLOCATED(); | 40 STACK_ALLOCATED(); |
| 42 WTF_MAKE_NONCOPYABLE(CSSParserImpl); | 41 WTF_MAKE_NONCOPYABLE(CSSParserImpl); |
| 43 | 42 |
| 44 public: | 43 public: |
| 45 CSSParserImpl(const CSSParserContext&, StyleSheetContents* = nullptr); | 44 CSSParserImpl(const CSSParserContext&, StyleSheetContents* = nullptr); |
| 46 | 45 |
| 47 enum AllowedRulesType { | 46 enum AllowedRulesType { |
| 48 // As per css-syntax, css-cascade and css-namespaces, @charset rules | 47 // As per css-syntax, css-cascade and css-namespaces, @charset rules |
| 49 // must come first, followed by @import then @namespace. | 48 // must come first, followed by @import then @namespace. |
| 50 // AllowImportRules actually means we allow @import and any rules thay | 49 // AllowImportRules actually means we allow @import and any rules thay |
| 51 // may follow it, i.e. @namespace rules and regular rules. | 50 // may follow it, i.e. @namespace rules and regular rules. |
| 52 // AllowCharsetRules and AllowNamespaceRules behave similarly. | 51 // AllowCharsetRules and AllowNamespaceRules behave similarly. |
| 53 AllowCharsetRules, | 52 AllowCharsetRules, |
| 54 AllowImportRules, | 53 AllowImportRules, |
| 55 AllowNamespaceRules, | 54 AllowNamespaceRules, |
| 56 RegularRules, | 55 RegularRules, |
| 57 KeyframeRules, | 56 KeyframeRules, |
| 58 ApplyRules, // For @apply inside style rules | 57 ApplyRules, // For @apply inside style rules |
| 59 NoRules, // For parsing at-rules inside declaration lists | 58 NoRules, // For parsing at-rules inside declaration lists |
| 60 }; | 59 }; |
| 61 | 60 |
| 62 static bool parseValue(MutableStylePropertySet*, | 61 static MutableStylePropertySet::SetResult parseValue(MutableStylePropertySet*, |
| 63 CSSPropertyID, | 62 CSSPropertyID, |
| 64 const String&, | 63 const String&, |
| 65 bool important, | 64 bool important, |
| 66 const CSSParserContext&); | 65 const CSSParserContext&); |
| 67 static bool parseVariableValue(MutableStylePropertySet*, | 66 static MutableStylePropertySet::SetResult parseVariableValue( |
| 68 const AtomicString& propertyName, | 67 MutableStylePropertySet*, |
| 69 const String&, | 68 const AtomicString& propertyName, |
| 70 bool important, | 69 const String&, |
| 71 const CSSParserContext&, | 70 bool important, |
| 72 bool isAnimationTainted); | 71 const CSSParserContext&, |
| 72 bool isAnimationTainted); |
| 73 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, | 73 static ImmutableStylePropertySet* parseInlineStyleDeclaration(const String&, |
| 74 Element*); | 74 Element*); |
| 75 static bool parseDeclarationList(MutableStylePropertySet*, | 75 static bool parseDeclarationList(MutableStylePropertySet*, |
| 76 const String&, | 76 const String&, |
| 77 const CSSParserContext&); | 77 const CSSParserContext&); |
| 78 static StyleRuleBase* parseRule(const String&, | 78 static StyleRuleBase* parseRule(const String&, |
| 79 const CSSParserContext&, | 79 const CSSParserContext&, |
| 80 StyleSheetContents*, | 80 StyleSheetContents*, |
| 81 AllowedRulesType); | 81 AllowedRulesType); |
| 82 static void parseStyleSheet(const String&, | 82 static void parseStyleSheet(const String&, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // For the inspector | 163 // For the inspector |
| 164 CSSParserObserverWrapper* m_observerWrapper; | 164 CSSParserObserverWrapper* m_observerWrapper; |
| 165 | 165 |
| 166 Member<CSSLazyParsingState> m_lazyState; | 166 Member<CSSLazyParsingState> m_lazyState; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 } // namespace blink | 169 } // namespace blink |
| 170 | 170 |
| 171 #endif // CSSParserImpl_h | 171 #endif // CSSParserImpl_h |
| OLD | NEW |