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

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

Issue 799003003: CSS Parser: Implement parseRule (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@attoken
Patch Set: rebase/address comments Created 5 years, 11 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
« no previous file with comments | « Source/core/css/parser/CSSParser.cpp ('k') | Source/core/css/parser/CSSParserImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
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 16
17 namespace blink { 17 namespace blink {
18 18
19 class StyleRule;
20 class StyleRuleBase;
19 class ImmutableStylePropertySet; 21 class ImmutableStylePropertySet;
20 class Element; 22 class Element;
21 class MutableStylePropertySet; 23 class MutableStylePropertySet;
22 24
23 class CSSParserImpl { 25 class CSSParserImpl {
24 STACK_ALLOCATED(); 26 STACK_ALLOCATED();
25 public: 27 public:
26 CSSParserImpl(const CSSParserContext&, const String&); 28 CSSParserImpl(const CSSParserContext&, const String&);
27 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&); 29 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String &, bool important, const CSSParserContext&);
28 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*); 30 static PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> parseInlineStyleDec laration(const String&, Element*);
29 static bool parseDeclaration(MutableStylePropertySet*, const String&, const CSSParserContext&); 31 static bool parseDeclaration(MutableStylePropertySet*, const String&, const CSSParserContext&);
32 static PassRefPtrWillBeRawPtr<StyleRuleBase> parseRule(const String&, const CSSParserContext&);
30 33
31 private: 34 private:
35 // These two functions update the range they're given
36 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeAtRule(CSSParserTokenRange&);
37 PassRefPtrWillBeRawPtr<StyleRuleBase> consumeQualifiedRule(CSSParserTokenRan ge&);
38
39 PassRefPtrWillBeRawPtr<StyleRule> consumeStyleRule(CSSParserTokenRange prelu de, CSSParserTokenRange block);
40
32 // FIXME: We should use a CSSRule::Type here 41 // FIXME: We should use a CSSRule::Type here
33 void consumeDeclarationList(CSSParserTokenRange, CSSRuleSourceData::Type); 42 void consumeDeclarationList(CSSParserTokenRange, CSSRuleSourceData::Type);
34 void consumeDeclaration(CSSParserTokenRange, CSSRuleSourceData::Type); 43 void consumeDeclaration(CSSParserTokenRange, CSSRuleSourceData::Type);
35 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, CSSRuleSourceData::Type); 44 void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool import ant, CSSRuleSourceData::Type);
36 45
37 // FIXME: Can we build StylePropertySets directly? 46 // FIXME: Can we build StylePropertySets directly?
38 // FIXME: Investigate using a smaller inline buffer 47 // FIXME: Investigate using a smaller inline buffer
39 WillBeHeapVector<CSSProperty, 256> m_parsedProperties; 48 WillBeHeapVector<CSSProperty, 256> m_parsedProperties;
40 Vector<CSSParserToken> m_tokens; 49 Vector<CSSParserToken> m_tokens;
41 CSSParserContext m_context; 50 CSSParserContext m_context;
42 51
43 // FIXME: We need to store a context style sheet, similar to the Bison parse r 52 // FIXME: We need to store a context style sheet, similar to the Bison parse r
44 // for at least crbug.com/9877 and marking that we've seen rem units. 53 // for at least crbug.com/9877 and marking that we've seen rem units.
45 }; 54 };
46 55
47 } // namespace blink 56 } // namespace blink
48 57
49 #endif // CSSParserImpl_h 58 #endif // CSSParserImpl_h
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSParser.cpp ('k') | Source/core/css/parser/CSSParserImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698