| Index: Source/core/html/parser/HTMLPreloadScanner.cpp
|
| diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| index d1e7e7976057d1b121a7547560d8f084cc57e31b..9fa599f8fa85bc6c2e28b532639ea76fcb840380 100644
|
| --- a/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| +++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
|
| @@ -36,6 +36,7 @@
|
| #include "core/css/parser/SizesAttributeParser.h"
|
| #include "core/dom/Document.h"
|
| #include "core/frame/Settings.h"
|
| +#include "core/html/HTMLImageElement.h"
|
| #include "core/html/HTMLMetaElement.h"
|
| #include "core/html/LinkRelAttribute.h"
|
| #include "core/html/parser/HTMLParserIdioms.h"
|
| @@ -117,6 +118,9 @@ public:
|
| , m_sourceSize(0)
|
| , m_sourceSizeSet(false)
|
| , m_isCORSEnabled(false)
|
| + , m_widthValue(0)
|
| + , m_widthValueSet(false)
|
| + , m_widthPresent(false)
|
| , m_defer(FetchRequest::NoDefer)
|
| , m_allowCredentials(DoNotAllowStoredCredentials)
|
| , m_mediaValues(mediaValues)
|
| @@ -180,7 +184,11 @@ public:
|
| if (m_sourceSizeSet && m_srcsetImageCandidate.resourceWidth() != UninitializedDescriptor) {
|
| resourceWidth.width = m_sourceSize;
|
| resourceWidth.isSet = true;
|
| + } else {
|
| + resourceWidth.isSet = m_widthValueSet;
|
| + resourceWidth.width = m_widthValue;
|
| }
|
| +
|
| OwnPtr<PreloadRequest> request = PreloadRequest::create(initiatorFor(m_tagImpl), position, m_urlToLoad, predictedBaseURL, resourceType(), resourceWidth, clientHintsPreferences, requestType);
|
| if (isCORSEnabled())
|
| request->setCrossOriginEnabled(allowStoredCredentials());
|
| @@ -223,6 +231,9 @@ private:
|
| m_srcsetImageCandidate = bestFitSourceForSrcsetAttribute(m_mediaValues->devicePixelRatio(), m_sourceSize, m_srcsetAttributeValue);
|
| setUrlToLoad(bestFitSourceForImageAttributes(m_mediaValues->devicePixelRatio(), m_sourceSize, m_imgSrcUrl, m_srcsetImageCandidate), AllowURLReplacement);
|
| }
|
| + } else if (match(attributeName, widthAttr) && !m_widthPresent) {
|
| + m_widthPresent = true;
|
| + m_widthValue = HTMLImageElement::widthAttributeToInt(attributeValue, m_widthValueSet);
|
| }
|
| }
|
|
|
| @@ -390,6 +401,9 @@ private:
|
| float m_sourceSize;
|
| bool m_sourceSizeSet;
|
| bool m_isCORSEnabled;
|
| + int m_widthValue;
|
| + bool m_widthValueSet;
|
| + bool m_widthPresent;
|
| FetchRequest::DeferOption m_defer;
|
| StoredCredentials m_allowCredentials;
|
| RefPtr<MediaValues> m_mediaValues;
|
|
|