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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp

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/CSSLazyParsingState.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
index b3d2ec5c849fbab7c3acbfb27b276ed83b41b87b..53e53ef7bdf4b206e654c6fa16495958c6b6d588 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
@@ -12,11 +12,9 @@
namespace blink {
CSSLazyParsingState::CSSLazyParsingState(const CSSParserContext& context,
- Vector<String> escapedStrings,
const String& sheetText,
StyleSheetContents* contents)
: m_context(context),
- m_escapedStrings(std::move(escapedStrings)),
m_sheetText(sheetText),
m_owningContents(contents),
m_parsedStyleRules(0),
@@ -28,9 +26,9 @@ CSSLazyParsingState::CSSLazyParsingState(const CSSParserContext& context,
}
CSSLazyPropertyParserImpl* CSSLazyParsingState::createLazyParser(
- const CSSParserTokenRange& block) {
+ size_t blockOffset) {
++m_totalStyleRules;
- return new CSSLazyPropertyParserImpl(std::move(block), this);
+ return new CSSLazyPropertyParserImpl(blockOffset, this);
}
const CSSParserContext& CSSLazyParsingState::context() {
@@ -63,16 +61,7 @@ void CSSLazyParsingState::countRuleParsed() {
}
bool CSSLazyParsingState::shouldLazilyParseProperties(
- const CSSSelectorList& selectors,
- const CSSParserTokenRange& block) const {
- // Simple heuristic for an empty block. Note that |block| here does not
- // include {} brackets. We avoid lazy parsing empty blocks so we can avoid
- // considering them when possible for matching. Lazy blocks must always be
- // considered. Three tokens is a reasonable minimum for a block:
- // ident ':' <value>.
- if (block.end() - block.begin() <= 2)
- return false;
-
+ const CSSSelectorList& selectors) const {
// Disallow lazy parsing for blocks which have before/after in their selector
// list. This ensures we don't cause a collectFeatures() when we trigger
// parsing for attr() functions which would trigger expensive invalidation

Powered by Google App Engine
This is Rietveld 408576698