Index: Source/core/html/HTMLImageElement.cpp |
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp |
index 30c86681dd7a5c4561fa6e1be5360d6ddb0eec71..a386da6fbe276f9941034c21ab9b9622c116a390 100644 |
--- a/Source/core/html/HTMLImageElement.cpp |
+++ b/Source/core/html/HTMLImageElement.cpp |
@@ -25,6 +25,7 @@ |
#include "CSSPropertyNames.h" |
#include "HTMLNames.h" |
+#include "RuntimeEnabledFeatures.h" |
#include "bindings/v8/ScriptEventListener.h" |
#include "core/dom/Attribute.h" |
#include "core/dom/EventNames.h" |
@@ -32,6 +33,7 @@ |
#include "core/html/HTMLAnchorElement.h" |
#include "core/html/HTMLFormElement.h" |
#include "core/html/parser/HTMLParserIdioms.h" |
+#include "core/html/parser/HTMLSrcsetParser.h" |
#include "core/rendering/RenderImage.h" |
using namespace std; |
@@ -107,13 +109,21 @@ void HTMLImageElement::collectStyleForPresentationAttribute(const QualifiedName& |
HTMLElement::collectStyleForPresentationAttribute(name, value, style); |
} |
+const AtomicString HTMLImageElement::imageSourceURL() const |
+{ |
+ return m_bestFitImageURL.isNull() ? 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) { |
+ if (RuntimeEnabledFeatures::srcsetEnabled()) |
+ m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr)); |
m_imageLoader.updateFromElementIgnoringPreviousError(); |
+ } |
else if (name == usemapAttr) |
setIsLink(!value.isNull()); |
else if (name == onbeforeloadAttr) |