Index: Source/core/html/parser/HTMLDocumentParser.cpp |
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp |
index 210185ef31d373e7382b9358cf672412d8a6b671..4815e3b1eb882cd7c7e76d6f751f8178b1db50cc 100644 |
--- a/Source/core/html/parser/HTMLDocumentParser.cpp |
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp |
@@ -27,6 +27,7 @@ |
#include "core/html/parser/HTMLDocumentParser.h" |
#include "HTMLNames.h" |
+#include "core/css/MediaValues.h" |
#include "core/dom/DocumentFragment.h" |
#include "core/dom/Element.h" |
#include "core/frame/LocalFrame.h" |
@@ -511,6 +512,13 @@ Document* HTMLDocumentParser::contextForParsingSession() |
return document(); |
} |
+static PassRefPtr<MediaValues> createMediaValues(Document* document) |
+{ |
+ RefPtr<MediaValues> mediaValues = MediaValues::create(document, MediaValues::CachingMode); |
+ ASSERT(mediaValues->isSafeToSendToAnotherThread()); |
+ return mediaValues; |
+} |
+ |
void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode) |
{ |
ASSERT(!isStopped()); |
@@ -571,7 +579,7 @@ void HTMLDocumentParser::pumpTokenizer(SynchronousMode mode) |
if (isWaitingForScripts()) { |
ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); |
if (!m_preloadScanner) { |
- m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, document()->url(), document()->devicePixelRatio())); |
+ m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, document()->url(), createMediaValues(document()))); |
m_preloadScanner->appendToEnd(m_input.current()); |
} |
m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); |
@@ -648,7 +656,7 @@ void HTMLDocumentParser::insert(const SegmentedString& source) |
// Check the document.write() output with a separate preload scanner as |
// the main scanner can't deal with insertions. |
if (!m_insertionPreloadScanner) |
- m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, document()->url(), document()->devicePixelRatio())); |
+ m_insertionPreloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, document()->url(), createMediaValues(document()))); |
m_insertionPreloadScanner->appendToEnd(source); |
m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL()); |
@@ -672,7 +680,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(), document()->devicePixelRatio())); |
+ config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().copy(), createMediaValues(document()))); |
config->decoder = takeDecoder(); |
ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |