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

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

Issue 2404463002: Avoid <picture> preloading when viewport not initialized. (Closed)
Patch Set: style Created 4 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 | « no previous file | 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/HTMLPreloadScanner.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
index 8884bdda02babbf08b12cce11402e8f9fc123491..ca946af2bac927e376623796dc96568139c231e9 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -807,7 +807,10 @@ void TokenPreloadScanner::scanCommon(const Token& token,
StartTagScanner scanner(tagImpl, m_mediaValues);
scanner.processAttributes(token.attributes());
- if (m_inPicture)
+ // TODO(yoav): ViewportWidth is currently racy and might be zero in some
+ // cases, at least in tests. That problem will go away once
+ // ParseHTMLOnMainThread lands and MediaValuesCached is eliminated.
+ if (m_inPicture && m_mediaValues->viewportWidth())
scanner.handlePictureSourceURL(m_pictureData);
std::unique_ptr<PreloadRequest> request = scanner.createPreloadRequest(
m_predictedBaseElementURL, source, m_clientHintsPreferences,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698