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

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

Issue 2503683003: [WIP] Streaming CSS parser (Closed)
Patch Set: rebase Created 3 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
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 CSSSelectorParser_h 5 #ifndef CSSSelectorParser_h
6 #define CSSSelectorParser_h 6 #define CSSSelectorParser_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/parser/CSSParserSelector.h" 9 #include "core/css/parser/CSSParserSelector.h"
10 #include "core/css/parser/CSSParserTokenRange.h" 10 #include "core/css/parser/CSSParserTokenRange.h"
11 #include <memory> 11 #include <memory>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class CSSParserContext; 15 class CSSParserContext;
16 class CSSParserObserver;
17 class CSSParserTokenStream;
16 class CSSSelectorList; 18 class CSSSelectorList;
17 class StyleSheetContents; 19 class StyleSheetContents;
18 20
19 // FIXME: We should consider building CSSSelectors directly instead of using 21 // FIXME: We should consider building CSSSelectors directly instead of using
20 // the intermediate CSSParserSelector. 22 // the intermediate CSSParserSelector.
21 class CORE_EXPORT CSSSelectorParser { 23 class CORE_EXPORT CSSSelectorParser {
22 STACK_ALLOCATED(); 24 STACK_ALLOCATED();
23 25
24 public: 26 public:
25 static CSSSelectorList parseSelector(CSSParserTokenRange, 27 static CSSSelectorList parseSelector(CSSParserTokenRange,
26 const CSSParserContext&, 28 const CSSParserContext&,
27 StyleSheetContents*); 29 StyleSheetContents*);
28 30
31 // Stops at { or EOF
32 static CSSSelectorList consumeSelector(CSSParserTokenStream&,
33 const CSSParserContext&,
34 StyleSheetContents*,
35 size_t startOffset,
36 CSSParserObserver*);
37
29 static bool consumeANPlusB(CSSParserTokenRange&, std::pair<int, int>&); 38 static bool consumeANPlusB(CSSParserTokenRange&, std::pair<int, int>&);
30 39
31 private: 40 private:
32 CSSSelectorParser(const CSSParserContext&, StyleSheetContents*); 41 CSSSelectorParser(const CSSParserContext&, StyleSheetContents*);
33 42
34 // These will all consume trailing comments if successful 43 // These will all consume trailing comments if successful
35 44
45 CSSSelectorList consumeComplexSelectorList(CSSParserTokenStream&,
46 size_t startOffset,
47 CSSParserObserver*);
48
36 CSSSelectorList consumeComplexSelectorList(CSSParserTokenRange&); 49 CSSSelectorList consumeComplexSelectorList(CSSParserTokenRange&);
37 CSSSelectorList consumeCompoundSelectorList(CSSParserTokenRange&); 50 CSSSelectorList consumeCompoundSelectorList(CSSParserTokenRange&);
38 51
39 std::unique_ptr<CSSParserSelector> consumeComplexSelector( 52 std::unique_ptr<CSSParserSelector> consumeComplexSelector(
40 CSSParserTokenRange&); 53 CSSParserTokenRange&);
41 std::unique_ptr<CSSParserSelector> consumeCompoundSelector( 54 std::unique_ptr<CSSParserSelector> consumeCompoundSelector(
42 CSSParserTokenRange&); 55 CSSParserTokenRange&);
43 // This doesn't include element names, since they're handled specially 56 // This doesn't include element names, since they're handled specially
44 std::unique_ptr<CSSParserSelector> consumeSimpleSelector( 57 std::unique_ptr<CSSParserSelector> consumeSimpleSelector(
45 CSSParserTokenRange&); 58 CSSParserTokenRange&);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 106
94 private: 107 private:
95 CSSSelectorParser* m_parser; 108 CSSSelectorParser* m_parser;
96 bool m_wasDisallowed; 109 bool m_wasDisallowed;
97 }; 110 };
98 }; 111 };
99 112
100 } // namespace blink 113 } // namespace blink
101 114
102 #endif // CSSSelectorParser_h 115 #endif // CSSSelectorParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698