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

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

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: esprehn review Created 4 years, 1 month 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/css/parser/CSSLazyParsingState.h"
6
7 namespace blink {
8
9 CSSLazyParsingState::CSSLazyParsingState(const CSSParserContext& context,
10 Vector<String> escapedStrings,
11 const String& sheetText)
12 : m_context(context),
13 m_escapedStrings(std::move(escapedStrings)),
14 m_sheetText(sheetText) {}
15
16 // Disallow lazy parsing for blocks which have
17 // - before/after in their selector list. This ensures we don't cause a
18 // collectFeatures() when we trigger parsing for attr() functions which would
19 // trigger expensive invalidation propagation.
20 //
21 // Note: another optimization might be to disallow lazy parsing for rules which
22 // will end up being empty. This is hard to know without parsing but we may be
23 // able to catch the {}, { } cases. This would be to hit
24 // StyleRule::shouldConsiderForMatchingRules more.
25 bool CSSLazyParsingState::shouldLazilyParseProperties(
26 const CSSSelectorList& selectors) {
27 for (const auto* s = selectors.first(); s; s = CSSSelectorList::next(*s)) {
28 const CSSSelector::PseudoType type(s->getPseudoType());
29 if (type == CSSSelector::PseudoBefore || type == CSSSelector::PseudoAfter)
30 return false;
31 }
32 return true;
33 }
34
35 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698