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

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

Issue 2292013002: Notify LayoutImage that intrinsic dimensions changed when sizes changes (Closed)
Patch Set: test improvements Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/sizes-changed-intrinsic-size-update.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLImageElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
index cab316648a46ec8a9b4c3be5ea27dd641e07bafc..50f9e02bdec277308a2ba2fd70f57d3649bff314 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
@@ -227,6 +227,7 @@ void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
{
m_bestFitImageURL = candidate.url();
float candidateDensity = candidate.density();
+ float oldImageDevicePixelRatio = m_imageDevicePixelRatio;
if (candidateDensity >= 0)
m_imageDevicePixelRatio = 1.0 / candidateDensity;
@@ -237,9 +238,13 @@ void HTMLImageElement::setBestFitURLAndDPRFromImageCandidate(const ImageCandidat
} else if (!candidate.srcOrigin()) {
UseCounter::count(document(), UseCounter::SrcsetXDescriptor);
}
- if (layoutObject() && layoutObject()->isImage())
+ if (layoutObject() && layoutObject()->isImage()) {
LayoutImageItem(toLayoutImage(layoutObject())).setImageDevicePixelRatio(m_imageDevicePixelRatio);
+ if (oldImageDevicePixelRatio != m_imageDevicePixelRatio)
+ toLayoutImage(layoutObject())->intrinsicSizeChanged();
+ }
+
if (intrinsicSizingViewportDependant) {
if (!m_listener)
m_listener = ViewportChangeListener::create(this);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/sizes-changed-intrinsic-size-update.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698