| Index: third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
|
| index 59c96a646cdd6bc98f2765b1a43d5e7d62918f6a..030f2578bd32f309b4f859cb1bd053177f8a055f 100644
|
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
|
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp
|
| @@ -172,12 +172,14 @@ void CSSParserImpl::parseStyleSheet(const String& string, const CSSParserContext
|
|
|
| TRACE_EVENT_BEGIN0("blink,blink_style", "CSSParserImpl::parseStyleSheet.parse");
|
| CSSParserImpl parser(context, styleSheet);
|
| + parser.enableLazyParsing();
|
| bool firstRuleValid = parser.consumeRuleList(scope.tokenRange(), TopLevelRuleList, [&styleSheet](StyleRuleBase* rule) {
|
| if (rule->isCharsetRule())
|
| return;
|
| styleSheet->parserAppendRule(rule);
|
| });
|
| styleSheet->setHasSyntacticallyValidCSSHeader(firstRuleValid);
|
| + styleSheet->populateStringPool(scope.stringPool());
|
| TRACE_EVENT_END0("blink,blink_style", "CSSParserImpl::parseStyleSheet.parse");
|
|
|
| TRACE_EVENT_END2(
|
| @@ -276,6 +278,13 @@ void CSSParserImpl::parseDeclarationListForInspector(const String& declaration,
|
| parser.consumeDeclarationList(scope.tokenRange(), StyleRule::Style);
|
| }
|
|
|
| +ImmutableStylePropertySet* CSSParserImpl::parseDeclarationListForLazyStyle(CSSParserTokenRange block, const CSSParserContext& context)
|
| +{
|
| + CSSParserImpl parser(context);
|
| + parser.consumeDeclarationList(block, StyleRule::Style);
|
| + return createStylePropertySet(parser.m_parsedProperties, context.mode());
|
| +}
|
| +
|
| void CSSParserImpl::parseStyleSheetForInspector(const String& string, const CSSParserContext& context, StyleSheetContents* styleSheet, CSSParserObserver& observer)
|
| {
|
| CSSParserImpl parser(context, styleSheet);
|
| @@ -684,8 +693,11 @@ StyleRule* CSSParserImpl::consumeStyleRule(CSSParserTokenRange prelude, CSSParse
|
| if (m_observerWrapper)
|
| observeSelectors(*m_observerWrapper, prelude);
|
|
|
| + // TODO(csharrison): How should we lazily parse css that needs the observer?
|
| + if (m_shouldUseLazyParsing && !m_observerWrapper) {
|
| + return StyleRule::createLazy(std::move(selectorList), block, &m_context);
|
| + }
|
| consumeDeclarationList(block, StyleRule::Style);
|
| -
|
| return StyleRule::create(std::move(selectorList), createStylePropertySet(m_parsedProperties, m_context.mode()));
|
| }
|
|
|
|
|