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

Unified Diff: Source/core/html/HTMLImageElement.cpp

Issue 23861003: Enable srcset support in HTMLImageElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Enable srcset support in HTMLImageElement Created 7 years, 3 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/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index bf88109ed9ecad7b640245f02d5216edaa77a176..94de19bed414eb8f3f9947ad9d5d9500adf81996 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -107,13 +107,20 @@ void HTMLImageElement::collectStyleForPresentationAttribute(const QualifiedName&
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
+const AtomicString HTMLImageElement::imageSourceURL() const
+{
+ return m_bestFitImageURL.isEmpty() ? fastGetAttribute(srcAttr) : m_bestFitImageURL;
+}
+
void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == altAttr) {
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->updateAltText();
- } else if (name == srcAttr)
+ } else if (name == srcAttr || name == srcsetAttr) {
+ m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
m_imageLoader.updateFromElementIgnoringPreviousError();
+ }
else if (name == usemapAttr)
setIsLink(!value.isNull());
else if (name == onbeforeloadAttr)

Powered by Google App Engine
This is Rietveld 408576698