Reviewed by Adam.
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2007 22:29:29 +0000 (22:29 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2007 22:29:29 +0000 (22:29 +0000)
        <rdar://problem/4943985>
        REGRESSION: Dragging standalone images to Finder fails to download the image file

        Set the data and response on the image resource. Also, since this is platform-independent we don't need to do it in
        ImageDocumentMac.mm

        * loader/ImageDocument.cpp:
        (WebCore::ImageTokenizer::finish):
        * loader/mac/ImageDocumentMac.h:
        * loader/mac/ImageDocumentMac.mm:
        (WebCore::finishImageLoad):

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

WebCore/ChangeLog
WebCore/loader/ImageDocument.cpp
WebCore/loader/mac/ImageDocumentMac.h
WebCore/loader/mac/ImageDocumentMac.mm

index 097ff55fc4f467482d68cf2c644f2230016992bb..0f426b1747a7ce0fab0de28fc8baf0c50eb3b522 100644 (file)
@@ -1,3 +1,19 @@
+2007-02-16  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Adam.
+
+        <rdar://problem/4943985> 
+        REGRESSION: Dragging standalone images to Finder fails to download the image file
+        
+        Set the data and response on the image resource. Also, since this is platform-independent we don't need to do it in 
+        ImageDocumentMac.mm
+        
+        * loader/ImageDocument.cpp:
+        (WebCore::ImageTokenizer::finish):
+        * loader/mac/ImageDocumentMac.h:
+        * loader/mac/ImageDocumentMac.mm:
+        (WebCore::finishImageLoad):
+
 2007-02-16  David Harrison  <harrison@apple.com>
 
         Reviewed by Adam.
index 079a9e0703a4b147a7d22dd44bfaeb2e5bc64532..0000169fe701e1bbaef877fa37bee406df00799e 100644 (file)
 #include "ImageDocument.h"
 
 #include "CachedImage.h"
+#include "DocumentLoader.h"
 #include "Element.h"
+#include "Frame.h"
+#include "FrameLoader.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
 #include "SegmentedString.h"
@@ -113,9 +116,12 @@ void ImageTokenizer::finish()
         cachedImage->data(buffer, true);
         cachedImage->finish();
 
+        cachedImage->setAllData(m_doc->frame()->loader()->mainResourceData());
+        cachedImage->setResponse(m_doc->frame()->loader()->documentLoader()->response());
+        
         // FIXME: Need code to set the title for platforms other than Mac OS X.
 #if PLATFORM(MAC)
-        finishImageLoad(m_doc, cachedImage, buffer.data(), buffer.size());
+        finishImageLoad(m_doc, cachedImage);
 #endif
     }
 
index a31baca49394ff6533a83381e2f505d9148028ec..3c7c50972fa411d6323c92574c9155eb0f9f676c 100644 (file)
@@ -30,7 +30,7 @@ namespace WebCore {
     class CachedImage;
     class Document;
 
-    void finishImageLoad(Document*, CachedImage*, const void* imageData, size_t imageDataSize);
+    void finishImageLoad(Document*, CachedImage*);
 
 }
 
index 2257f9a8507aaa884d7b102a69cf24111c35bf98..585ac4e410ebf84ff6da60d78199da5cf5dd7fbe 100644 (file)
 
 namespace WebCore {
     
-void finishImageLoad(Document* document, CachedImage* image, const void* imageData, size_t imageDataSize)
+void finishImageLoad(Document* document, CachedImage* image)
 {
-    // FIXME: This is terrible! Makes an extra copy of the image data!
-    // Can't we get the NSData from NSURLConnection?
-    // Why is this different from image subresources?
-    RefPtr<SharedBuffer> buffer = new SharedBuffer(reinterpret_cast<const char*>(imageData), imageDataSize);
-
     Frame* frame = document->frame();
     const ResourceResponse& response = frame->loader()->documentLoader()->response();