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

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

Issue 1078633003: Added preloader support for sizes based RW values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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: Source/core/html/parser/HTMLPreloadScanner.cpp
diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
index d554c9b3c8c7a38a717b2e59b88254e44d473d9e..2a5dcb3b168ed8c8df62ce7f8a343cbd159b8029 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -112,6 +112,7 @@ public:
, m_inputIsImage(false)
, m_sourceSize(0)
, m_sourceSizeSet(false)
+ , m_resourceWidth(-1)
, m_isCORSEnabled(false)
, m_defer(FetchRequest::NoDefer)
, m_allowCredentials(DoNotAllowStoredCredentials)
@@ -168,7 +169,7 @@ public:
return nullptr;
TextPosition position = TextPosition(source.currentLine(), source.currentColumn());
- OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, resourceType());
+ OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, resourceType(), m_resourceWidth);
if (isCORSEnabled())
request->setCrossOriginEnabled(allowStoredCredentials());
request->setCharset(charset());
@@ -209,6 +210,8 @@ private:
if (!m_srcsetImageCandidate.isEmpty()) {
m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValues->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue);
setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacement);
+ } else {
+ m_resourceWidth = m_sourceSize;
}
}
}
@@ -373,6 +376,7 @@ private:
String m_srcsetAttributeValue;
unsigned m_sourceSize;
bool m_sourceSizeSet;
+ int m_resourceWidth;
bool m_isCORSEnabled;
FetchRequest::DeferOption m_defer;
StoredCredentials m_allowCredentials;

Powered by Google App Engine
This is Rietveld 408576698