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

Unified Diff: Source/WebCore/loader/cache/CachedImage.cpp

Issue 10379031: Merge 114095 - Background width (or height) is wrong if width (or height) * zoom < 1. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 7 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/WebCore/loader/cache/CachedImage.cpp
===================================================================
--- Source/WebCore/loader/cache/CachedImage.cpp (revision 116270)
+++ Source/WebCore/loader/cache/CachedImage.cpp (working copy)
@@ -259,15 +259,12 @@
return imageSize;
// Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
- bool hasWidth = imageSize.width() > 0;
- bool hasHeight = imageSize.height() > 0;
- int width = imageSize.width() * (m_image->hasRelativeWidth() ? 1.0f : multiplier);
- int height = imageSize.height() * (m_image->hasRelativeHeight() ? 1.0f : multiplier);
- if (hasWidth)
- width = max(1, width);
- if (hasHeight)
- height = max(1, height);
- return IntSize(width, height);
+ float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier;
+ float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier;
+ IntSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
+ imageSize.scale(widthScale, heightScale);
+ imageSize.clampToMinimumSize(minimumSize);
+ return imageSize;
}
void CachedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio, float scaleFactor)
« no previous file with comments | « LayoutTests/fast/css/zoom-background-repeat-y-expected.html ('k') | Source/WebCore/platform/graphics/IntSize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698