Reviewed by Maciej.
[WebKit-https.git] / WebCore / loader / ImageDocument.cpp
index 0dbef622446c081a7367219d46522e5467234149..842102e4546178c0f01f23e406f3ef49444e0eae 100644 (file)
@@ -159,7 +159,7 @@ void ImageDocument::createDocumentStructure()
     
     body->appendChild(imageElement, ec);
     
-    if (!frame()->page()->settings()->shrinksStandaloneImagesToFit())
+    if (!shouldShrinkToFit())
         return;
     
     // Add event listeners
@@ -226,7 +226,7 @@ void ImageDocument::imageChanged()
     
     m_imageSizeIsKnown = true;
     
-    if (!frame()->page()->settings()->shrinksStandaloneImagesToFit())
+    if (!shouldShrinkToFit())
         return;
     
     // Force resizing of the image
@@ -301,6 +301,12 @@ CachedImage* ImageDocument::cachedImage()
     return m_imageElement->cachedImage();
 }
 
+bool ImageDocument::shouldShrinkToFit() const
+{
+    return frame()->page()->settings()->shrinksStandaloneImagesToFit() &&
+        frame()->page()->mainFrame() == frame();
+}
+
 void ImageEventListener::handleEvent(Event* event, bool isWindowEvent)
 {
     if (event->type() == resizeEvent)