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

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

Issue 1738133002: Add support for media attribute on link (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review nits Created 4 years, 9 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
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 0ed9b645e97913e65ae42861cfb2848a1a67024c..46dc923ca0d4935249a19eddb1aa2668eecf5853 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -43,6 +43,7 @@
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/loader/DocumentLoader.h"
+#include "core/loader/LinkLoader.h"
#include "core/loader/NavigationScheduler.h"
#include "platform/SharedBuffer.h"
#include "platform/ThreadSafeFunctional.h"
@@ -127,6 +128,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
, m_pumpSessionNestingLevel(0)
, m_pumpSpeculationsSessionNestingLevel(0)
, m_isParsingAtLineNumber(false)
+ , m_triedLoadingLinkHeaders(false)
{
ASSERT(shouldUseThreading() || (m_token && m_tokenizer));
}
@@ -490,6 +492,16 @@ size_t HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Par
if (!m_queuedPreloads.isEmpty() && document()->documentElement())
m_preloader->takeAndPreload(m_queuedPreloads);
+ if (!m_triedLoadingLinkHeaders && document()->loader()) {
+ String linkHeader = document()->loader()->response().httpHeaderField(HTTPNames::Link);
+ if (!linkHeader.isEmpty()) {
+ ASSERT(chunk);
+ LinkLoader::loadLinksFromHeader(linkHeader, document()->loader()->response().url(),
+ document(), NetworkHintsInterfaceImpl(), LinkLoader::OnlyLoadResources, &(chunk->viewport));
+ m_triedLoadingLinkHeaders = true;
+ }
+ }
+
if (isWaitingForScripts()) {
ASSERT(it + 1 == tokens->end()); // The </script> is assumed to be the last token of this bunch.
runScriptsForPausedTreeBuilder();
@@ -664,7 +676,7 @@ void HTMLDocumentParser::pumpTokenizer()
MediaValuesCached::MediaValuesCachedData(*document()));
m_preloadScanner->appendToEnd(m_input.current());
}
- m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+ m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL(), nullptr);
}
}
@@ -751,7 +763,7 @@ void HTMLDocumentParser::insert(const SegmentedString& source)
}
m_insertionPreloadScanner->appendToEnd(source);
- m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+ m_insertionPreloadScanner->scan(m_preloader.get(), document()->baseElementURL(), nullptr);
}
endIfDelayed();
@@ -831,7 +843,7 @@ void HTMLDocumentParser::append(const String& inputSource)
} else {
m_preloadScanner->appendToEnd(source);
if (isWaitingForScripts())
- m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+ m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL(), nullptr);
}
}
@@ -1011,7 +1023,7 @@ void HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan()
{
ASSERT(m_preloadScanner);
m_preloadScanner->appendToEnd(m_input.current());
- m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
+ m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL(), nullptr);
}
void HTMLDocumentParser::notifyScriptLoaded(Resource* cachedResource)

Powered by Google App Engine
This is Rietveld 408576698