Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserImpl.h

Issue 1645433002: Basic implementation of @apply (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix expted.txt for failing test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // As per css-syntax, css-cascade and css-namespaces, @charset rules 44 // As per css-syntax, css-cascade and css-namespaces, @charset rules
45 // must come first, followed by @import then @namespace. 45 // must come first, followed by @import then @namespace.
46 // AllowImportRules actually means we allow @import and any rules thay 46 // AllowImportRules actually means we allow @import and any rules thay
47 // may follow it, i.e. @namespace rules and regular rules. 47 // may follow it, i.e. @namespace rules and regular rules.
48 // AllowCharsetRules and AllowNamespaceRules behave similarly. 48 // AllowCharsetRules and AllowNamespaceRules behave similarly.
49 AllowCharsetRules, 49 AllowCharsetRules,
50 AllowImportRules, 50 AllowImportRules,
51 AllowNamespaceRules, 51 AllowNamespaceRules,
52 RegularRules, 52 RegularRules,
53 KeyframeRules, 53 KeyframeRules,
54 ApplyRules, // For @apply inside style rules
54 NoRules, // For parsing at-rules inside declaration lists 55 NoRules, // For parsing at-rules inside declaration lists
55 }; 56 };
56 57
57 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&); 58 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&);
58 static bool parseVariableValue(MutableStylePropertySet*, const AtomicString& propertyName, const String&, bool important, const CSSParserContext&); 59 static bool parseVariableValue(MutableStylePropertySet*, const AtomicString& propertyName, const String&, bool important, const CSSParserContext&);
59 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*); 60 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*);
60 static bool parseDeclarationList(MutableStylePropertySet*, const String&, co nst CSSParserContext&); 61 static bool parseDeclarationList(MutableStylePropertySet*, const String&, co nst CSSParserContext&);
61 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const String&, const CSSParserContext&, StyleSheetContents*, AllowedRulesType); 62 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const String&, const CSSParserContext&, StyleSheetContents*, AllowedRulesType);
62 static void parseStyleSheet(const String&, const CSSParserContext&, StyleShe etContents*); 63 static void parseStyleSheet(const String&, const CSSParserContext&, StyleShe etContents*);
63 static CSSSelectorList parsePageSelector(CSSParserTokenRange, StyleSheetCont ents*); 64 static CSSSelectorList parsePageSelector(CSSParserTokenRange, StyleSheetCont ents*);
64 65
66 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseCustomProperty Set(CSSParserTokenRange);
67
65 static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&); 68 static PassOwnPtr<Vector<double>> parseKeyframeKeyList(const String&);
66 69
67 bool supportsDeclaration(CSSParserTokenRange&); 70 bool supportsDeclaration(CSSParserTokenRange&);
68 71
69 static void parseDeclarationListForInspector(const String&, const CSSParserC ontext&, CSSParserObserver&); 72 static void parseDeclarationListForInspector(const String&, const CSSParserC ontext&, CSSParserObserver&);
70 static void parseStyleSheetForInspector(const String&, const CSSParserContex t&, StyleSheetContents*, CSSParserObserver&); 73 static void parseStyleSheetForInspector(const String&, const CSSParserContex t&, StyleSheetContents*, CSSParserObserver&);
71 74
72 private: 75 private:
73 enum RuleListType { 76 enum RuleListType {
74 TopLevelRuleList, 77 TopLevelRuleList,
(...skipping 11 matching lines...) Expand all
86 89
87 static PassRefPtrWillBeRawPtr<StyleRuleCharset> consumeCharsetRule(CSSParser TokenRange prelude); 90 static PassRefPtrWillBeRawPtr<StyleRuleCharset> consumeCharsetRule(CSSParser TokenRange prelude);
88 PassRefPtrWillBeRawPtr<StyleRuleImport> consumeImportRule(CSSParserTokenRang e prelude); 91 PassRefPtrWillBeRawPtr<StyleRuleImport> consumeImportRule(CSSParserTokenRang e prelude);
89 PassRefPtrWillBeRawPtr<StyleRuleNamespace> consumeNamespaceRule(CSSParserTok enRange prelude); 92 PassRefPtrWillBeRawPtr<StyleRuleNamespace> consumeNamespaceRule(CSSParserTok enRange prelude);
90 PassRefPtrWillBeRawPtr<StyleRuleMedia> consumeMediaRule(CSSParserTokenRange prelude, CSSParserTokenRange block); 93 PassRefPtrWillBeRawPtr<StyleRuleMedia> consumeMediaRule(CSSParserTokenRange prelude, CSSParserTokenRange block);
91 PassRefPtrWillBeRawPtr<StyleRuleSupports> consumeSupportsRule(CSSParserToken Range prelude, CSSParserTokenRange block); 94 PassRefPtrWillBeRawPtr<StyleRuleSupports> consumeSupportsRule(CSSParserToken Range prelude, CSSParserTokenRange block);
92 PassRefPtrWillBeRawPtr<StyleRuleViewport> consumeViewportRule(CSSParserToken Range prelude, CSSParserTokenRange block); 95 PassRefPtrWillBeRawPtr<StyleRuleViewport> consumeViewportRule(CSSParserToken Range prelude, CSSParserTokenRange block);
93 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken Range prelude, CSSParserTokenRange block); 96 PassRefPtrWillBeRawPtr<StyleRuleFontFace> consumeFontFaceRule(CSSParserToken Range prelude, CSSParserTokenRange block);
94 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP refixed, CSSParserTokenRange prelude, CSSParserTokenRange block); 97 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> consumeKeyframesRule(bool webkitP refixed, CSSParserTokenRange prelude, CSSParserTokenRange block);
95 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr elude, CSSParserTokenRange block); 98 PassRefPtrWillBeRawPtr<StyleRulePage> consumePageRule(CSSParserTokenRange pr elude, CSSParserTokenRange block);
99 // Updates m_parsedProperties
100 void consumeApplyRule(CSSParserTokenRange prelude);
96 101
97 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser TokenRange prelude, CSSParserTokenRange block); 102 PassRefPtrWillBeRawPtr<StyleRuleKeyframe> consumeKeyframeStyleRule(CSSParser TokenRange prelude, CSSParserTokenRange block);
98 PassRefPtrWillBeRawPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelu de, CSSParserTokenRange block); 103 PassRefPtrWillBeRawPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelu de, CSSParserTokenRange block);
99 104
100 void consumeDeclarationList(CSSParserTokenRange, StyleRule::RuleType); 105 void consumeDeclarationList(CSSParserTokenRange, StyleRule::RuleType);
101 void consumeDeclaration(CSSParserTokenRange, StyleRule::RuleType); 106 void consumeDeclaration(CSSParserTokenRange, StyleRule::RuleType);
102 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, StyleRule::RuleType); 107 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, StyleRule::RuleType);
103 void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyN ame, bool important); 108 void consumeVariableValue(CSSParserTokenRange, const AtomicString& propertyN ame, bool important);
104 109
105 static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange ); 110 static PassOwnPtr<Vector<double>> consumeKeyframeKeyList(CSSParserTokenRange );
106 111
107 // FIXME: Can we build StylePropertySets directly? 112 // FIXME: Can we build StylePropertySets directly?
108 // FIXME: Investigate using a smaller inline buffer 113 // FIXME: Investigate using a smaller inline buffer
109 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; 114 WillBeHeapVector<CSSProperty, 256> m_parsedProperties;
110 CSSParserContext m_context; 115 CSSParserContext m_context;
111 116
112 RawPtrWillBeMember<StyleSheetContents> m_styleSheet; 117 RawPtrWillBeMember<StyleSheetContents> m_styleSheet;
113 118
114 // For the inspector 119 // For the inspector
115 CSSParserObserverWrapper* m_observerWrapper; 120 CSSParserObserverWrapper* m_observerWrapper;
116 }; 121 };
117 122
118 } // namespace blink 123 } // namespace blink
119 124
120 #endif // CSSParserImpl_h 125 #endif // CSSParserImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698