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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSTokenizer.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSTokenizer.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.h b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.h
index a03d8d6cc4811d7bfeef208be5a714327c6e201e..85e0150ac37e239eac3a79913711f4137c694c52 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizer.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizer.h
@@ -18,7 +18,7 @@
namespace blink {
class CSSTokenizerInputStream;
-class CSSParserObserverWrapper;
+class CSSParserObserver;
class CSSParserTokenRange;
class CORE_EXPORT CSSTokenizer {
@@ -26,16 +26,15 @@ class CORE_EXPORT CSSTokenizer {
DISALLOW_NEW();
public:
- CSSTokenizer(const String&);
- CSSTokenizer(const String&, CSSParserObserverWrapper&); // For the inspector
+ CSSTokenizer(const String&, size_t startOffset = 0);
CSSParserTokenRange tokenRange();
- unsigned tokenCount();
Vector<String> takeEscapedStrings() { return std::move(m_stringPool); }
private:
CSSParserToken nextToken();
+ void tokenizeSingle();
UChar consume();
void reconsume(UChar);
@@ -100,12 +99,24 @@ class CORE_EXPORT CSSTokenizer {
using CodePoint = CSSParserToken (CSSTokenizer::*)(UChar);
static const CodePoint codePoints[];
+ void skipToBlockEnd();
+ void skipComments();
+ void skipWhitespaceAndComments();
+ void yieldComments(CSSParserObserver&);
+
+ bool skipIdentCharacters(UChar);
+ void skipIdentCharacters();
+
CSSTokenizerInputStream m_input;
Vector<CSSParserTokenType, 8> m_blockStack;
Vector<CSSParserToken, 32> m_tokens;
// We only allocate strings when escapes are used.
Vector<String> m_stringPool;
+
+ bool m_finishedTokenizing = false;
+
+ friend class CSSParserTokenStream;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698