Reviewed by Sam.
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2007 21:53:38 +0000 (21:53 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2007 21:53:38 +0000 (21:53 +0000)
        Don't install event handlers or set the zoom cursor if auto-shrink has been disabled.

        * loader/ImageDocument.cpp:
        (WebCore::ImageDocument::createDocumentStructure):
        (WebCore::ImageDocument::imageChanged):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/loader/ImageDocument.cpp

index f36ce04551c70fb11065300aeefd11edf21fbc57..83031cba07a29fe85c1abbbfda45d3160fb1f8fd 100644 (file)
@@ -1,3 +1,13 @@
+2007-11-29  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Sam.
+
+        Don't install event handlers or set the zoom cursor if auto-shrink has been disabled.
+
+        * loader/ImageDocument.cpp:
+        (WebCore::ImageDocument::createDocumentStructure):
+        (WebCore::ImageDocument::imageChanged):
+
 2007-11-29  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Geoff.
index c5f5c2ef12f8d64a157b7803c8fe704308f36ed0..e4fffb0d59bcfecb741f433c08cd5f59b1c8e8e5 100644 (file)
@@ -159,10 +159,12 @@ void ImageDocument::createDocumentStructure()
     
     body->appendChild(imageElement, ec);
     
-    // Add event listeners
-    RefPtr<EventListener> listener = new ImageEventListener(this);
-    addWindowEventListener("resize", listener, false);
-    m_imageElement->addEventListener("click", listener.release(), false);
+    if (shouldShrinkToFit()) {
+        // Add event listeners
+        RefPtr<EventListener> listener = new ImageEventListener(this);
+        addWindowEventListener("resize", listener, false);
+        m_imageElement->addEventListener("click", listener.release(), false);
+    }
 }
 
 float ImageDocument::scale() const
@@ -223,8 +225,10 @@ void ImageDocument::imageChanged()
     
     m_imageSizeIsKnown = true;
     
-    // Force resizing of the image
-    windowSizeChanged();
+    if (shouldShrinkToFit()) {
+        // Force resizing of the image
+        windowSizeChanged();
+    }
 }
 
 void ImageDocument::restoreImageSize()