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

Unified Diff: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp

Issue 1420073002: Make sure StyleResolver sets viewport before initializing HTMLPreloadScanner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid XHR as well Created 5 years, 2 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
« no previous file with comments | « content/test/data/resource_loading/resource_loading_non_mobile.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
index 80f5c230a6944b5491b1c1372e8246f6ea88a9bc..8f8e073d69edf3a374985b94d2da5efb2731ee39 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -28,6 +28,7 @@
#include "core/HTMLNames.h"
#include "core/css/MediaValuesCached.h"
+#include "core/css/resolver/StyleResolver.h"
#include "core/dom/DocumentFragment.h"
#include "core/dom/DocumentLifecycleObserver.h"
#include "core/dom/Element.h"
@@ -778,6 +779,10 @@ void HTMLDocumentParser::startBackgroundParser()
ASSERT(document());
m_haveBackgroundParser = true;
+ // Make sure that a resolver is set up, so that the correct viewport dimensions will be fed to the background parser and preload scanner.
+ if (document()->loader())
+ document()->ensureStyleResolver();
+
RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<BackgroundHTMLParser>::createUnbound();
m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
@@ -792,6 +797,7 @@ void HTMLDocumentParser::startBackgroundParser()
config->parser = m_weakFactory.createWeakPtr();
config->xssAuditor = adoptPtr(new XSSAuditor);
config->xssAuditor->init(document(), &m_xssAuditorDelegate);
+
config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().copy(), CachedDocumentParameters::create(document())));
config->decoder = takeDecoder();
if (document()->settings()) {
« no previous file with comments | « content/test/data/resource_loading/resource_loading_non_mobile.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698