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

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

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed expected test results Created 7 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
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 68ee58fc2406e89426fba1bc9b8d5fbf1be0dece..b6d7772dcefd884f171aa026dc9797e91109b43a 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -47,6 +47,7 @@ HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document& docum
, m_imageLoader(this)
, m_form(form)
, m_compositeOperator(CompositeSourceOver)
+ , m_intrinsicSizeFactor(1.0f)
{
ASSERT(hasTagName(imgTag));
ScriptWrappable::init(this);
@@ -121,7 +122,7 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
toRenderImage(renderer())->updateAltText();
} else if (name == srcAttr || name == srcsetAttr) {
if (RuntimeEnabledFeatures::srcsetEnabled())
- m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr));
+ m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePixelRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr), m_intrinsicSizeFactor);
m_imageLoader.updateFromElementIgnoringPreviousError();
}
else if (name == usemapAttr)
@@ -156,6 +157,7 @@ RenderObject* HTMLImageElement::createRenderer(RenderStyle* style)
RenderImage* image = new RenderImage(this);
image->setImageResource(RenderImageResource::create());
+ image->setIntrinsicSizeFactor(m_intrinsicSizeFactor);
pdr. 2013/10/11 05:17:33 I'm not sure this will work for dynamic changes. F
Yoav Weiss 2013/10/11 07:22:32 Good catch! Will fix.
return image;
}

Powered by Google App Engine
This is Rietveld 408576698