Index: Source/core/rendering/svg/RenderSVGImage.cpp |
diff --git a/Source/core/rendering/svg/RenderSVGImage.cpp b/Source/core/rendering/svg/RenderSVGImage.cpp |
index 5e4fa8188291b8064133a2eac15769ddc5ea7bf3..11200b437224fc8270c1fbbd0e22b30968f80011 100644 |
--- a/Source/core/rendering/svg/RenderSVGImage.cpp |
+++ b/Source/core/rendering/svg/RenderSVGImage.cpp |
@@ -77,6 +77,15 @@ FloatSize RenderSVGImage::computeImageViewportSize(ImageResource& cachedImage) c |
return intrinsicRatio; |
} |
+static bool containerSizeIsSetForRenderer(ImageResource& cachedImage, const RenderObject* renderer) |
pdr.
2015/01/29 19:32:21
Can we put this on ImageResource?
fs
2015/01/30 09:30:20
I considered that, but since it didn't seem univer
|
+{ |
+ const Image* image = cachedImage.image(); |
+ // If a container size has been specified for this renderer, then |
+ // imageForRenderer() will return the SVGImageForContainer while image() |
+ // will return the underlying SVGImage. |
+ return !image->isSVGImage() || image != cachedImage.imageForRenderer(renderer); |
+} |
+ |
bool RenderSVGImage::updateImageViewport() |
{ |
SVGImageElement* image = toSVGImageElement(element()); |
@@ -90,7 +99,8 @@ bool RenderSVGImage::updateImageViewport() |
ImageResource* cachedImage = m_imageResource->cachedImage(); |
if (cachedImage && cachedImage->usesImageContainerSize()) { |
FloatSize imageViewportSize = computeImageViewportSize(*cachedImage); |
- if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(style()->effectiveZoom())) { |
+ if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(style()->effectiveZoom()) |
+ || !containerSizeIsSetForRenderer(*cachedImage, this)) { |
m_imageResource->setContainerSizeForRenderer(roundedIntSize(imageViewportSize)); |
updatedViewport = true; |
} |