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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSLazyPropertyParserImpl.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #include "core/css/parser/CSSLazyPropertyParserImpl.h" 5 #include "core/css/parser/CSSLazyPropertyParserImpl.h"
6 6
7 #include "core/css/parser/CSSLazyParsingState.h" 7 #include "core/css/parser/CSSLazyParsingState.h"
8 #include "core/css/parser/CSSParserImpl.h" 8 #include "core/css/parser/CSSParserImpl.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 CSSLazyPropertyParserImpl::CSSLazyPropertyParserImpl(CSSParserTokenRange block, 12 CSSLazyPropertyParserImpl::CSSLazyPropertyParserImpl(size_t startOffset,
13 CSSLazyParsingState* state) 13 CSSLazyParsingState* state)
14 : CSSLazyPropertyParser(), m_lazyState(state) { 14 : CSSLazyPropertyParser(), m_startOffset(startOffset), m_lazyState(state) {}
15 // Reserve capacity to minimize heap bloat.
16 size_t length = block.end() - block.begin();
17 m_tokens.reserveCapacity(length);
18 m_tokens.append(block.begin(), length);
19 }
20 15
21 StylePropertySet* CSSLazyPropertyParserImpl::parseProperties() { 16 StylePropertySet* CSSLazyPropertyParserImpl::parseProperties() {
22 m_lazyState->countRuleParsed(); 17 m_lazyState->countRuleParsed();
23 return CSSParserImpl::parseDeclarationListForLazyStyle( 18 return CSSParserImpl::parseDeclarationListForLazyStyle(
24 m_tokens, m_lazyState->context()); 19 m_lazyState->sheetText(), m_startOffset, m_lazyState->context());
25 } 20 }
26 21
27 } // namespace blink 22 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698