<rdar://problem/
5400029> iframes with an image src rarely load image
Don't try to shrink standalone images in subframes. The resize event is not
sent for subframes which screws up the shrink-to-fit logic.
* loader/ImageDocument.cpp:
(WebCore::ImageDocument::createDocumentStructure):
(WebCore::ImageDocument::imageChanged):
(WebCore::ImageDocument::shouldShrinkToFit):
* loader/ImageDocument.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24967
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-08-09 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5400029> iframes with an image src rarely load image
+
+ Don't try to shrink standalone images in subframes. The resize event is not
+ sent for subframes which screws up the shrink-to-fit logic.
+
+ * loader/ImageDocument.cpp:
+ (WebCore::ImageDocument::createDocumentStructure):
+ (WebCore::ImageDocument::imageChanged):
+ (WebCore::ImageDocument::shouldShrinkToFit):
+ * loader/ImageDocument.h:
+
2007-08-10 Holger Hans Peter Freyther <zecke@selfish.org>
Reviewed by Adam.
body->appendChild(imageElement, ec);
- if (!frame()->page()->settings()->shrinksStandaloneImagesToFit())
+ if (!shouldShrinkToFit())
return;
// Add event listeners
m_imageSizeIsKnown = true;
- if (!frame()->page()->settings()->shrinksStandaloneImagesToFit())
+ if (!shouldShrinkToFit())
return;
// Force resizing of the image
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)
void resizeImageToFit();
void restoreImageSize();
bool imageFitsInWindow() const;
+ bool shouldShrinkToFit() const;
float scale() const;
HTMLImageElement* m_imageElement;