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) |