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

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 1661013002: Atomic scaling in ImageResource::imageSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use integer literals for floats when possible; remove useless assert Created 4 years, 10 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 | « no previous file | 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/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index 1c9b1e124753c34dd1e75130cba65cb152d1be03..d9cdec5cdd91c44aefdbcd9366b37af997da5c6f 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -220,19 +220,16 @@ LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectIma
size = LayoutSize(m_image->size());
if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue && m_devicePixelRatioHeaderValue > 0)
- multiplier = 1.0 / m_devicePixelRatioHeaderValue;
+ multiplier = 1 / m_devicePixelRatioHeaderValue;
- if (multiplier == 1.0f)
+ if (multiplier == 1 || m_image->hasRelativeSize())
return size;
// Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
- float widthScale = m_image->hasRelativeSize() ? 1.0f : multiplier;
- float heightScale = m_image->hasRelativeSize() ? 1.0f : multiplier;
LayoutSize minimumSize(size.width() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit(),
LayoutUnit(size.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit()));
- size.scale(widthScale, heightScale);
+ size.scale(multiplier);
size.clampToMinimumSize(minimumSize);
- ASSERT(multiplier != 1.0f || (size.width().fraction() == 0.0f && size.height().fraction() == 0.0f));
return size;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698