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..e049b555cb7e107bbb10f40932f17c7fa2b3714c 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/MediaQueryEvaluator.h" |
#include "core/dom/DocumentFragment.h" |
#include "core/dom/Element.h" |
#include "core/frame/LocalFrame.h" |
@@ -495,7 +496,7 @@ void HTMLDocumentParser::forcePlaintextForTextDocument() |
// This method is called before any data is appended, so we have to start |
// the background parser ourselves. |
if (!m_haveBackgroundParser) |
- startBackgroundParser(); |
+ startBackgroundParser(MediaValues::create(document())); |
abarth-chromium
2014/03/24 19:43:31
This doesn't seem correct. We have a Config objec
|
HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::forcePlaintextForTextDocument, m_backgroundParser)); |
} else |
@@ -571,7 +572,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(), document()->devicePixelRatio(), MediaValues::create(document()))); |
abarth-chromium
2014/03/24 19:43:31
Isn't devicePixelRatio contained in MediaValues?
|
m_preloadScanner->appendToEnd(m_input.current()); |
} |
m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); |
@@ -648,7 +649,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(), document()->devicePixelRatio(), MediaValues::create(document()))); |
m_insertionPreloadScanner->appendToEnd(source); |
m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL()); |
@@ -657,7 +658,7 @@ void HTMLDocumentParser::insert(const SegmentedString& source) |
endIfDelayed(); |
} |
-void HTMLDocumentParser::startBackgroundParser() |
+void HTMLDocumentParser::startBackgroundParser(PassRefPtr<MediaValues> mediaValues) |
{ |
ASSERT(!isStopped()); |
ASSERT(shouldUseThreading()); |
@@ -672,7 +673,10 @@ 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())); |
+ // TODO |
+ // Make sure we're on the main thread, and get frame and style to create them |
+ // Pass MediaValues to the TokenPreloadScanner directly |
+ config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().copy(), document()->devicePixelRatio(), mediaValues)); |
config->decoder = takeDecoder(); |
ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
@@ -970,7 +974,7 @@ void HTMLDocumentParser::appendBytes(const char* data, size_t length) |
if (shouldUseThreading()) { |
if (!m_haveBackgroundParser) |
- startBackgroundParser(); |
+ startBackgroundParser(MediaValues::create(document())); |
OwnPtr<Vector<char> > buffer = adoptPtr(new Vector<char>(length)); |
memcpy(buffer->data(), data, length); |