Bug 12959

Summary: REGRESSION: Edit -> Copy not enabled on standalone images
Product: WebKit Reporter: Matt Lilek <dev+webkit>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: InRadar, Regression
Priority: P1    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
URL: http://webkit.org/images/icon-gold.png
Attachments:
Description Flags
Proposed patch
mitz: review-
Proposed Patch 2
andrew: review-
Proposed patch 3 justin.garcia: review+

Matt Lilek
Reported 2007-03-03 12:26:29 PST
Load a standalone image such as http://webkit.org/images/icon-gold.png. The Edit -> Copy menu item isn't enabled. This is a regression from Safari 2.0.4.
Attachments
Proposed patch (179.26 KB, patch)
2007-03-29 22:35 PDT, Andrew Wellington
mitz: review-
Proposed Patch 2 (79.47 KB, patch)
2007-03-31 01:03 PDT, Andrew Wellington
andrew: review-
Proposed patch 3 (79.42 KB, patch)
2007-03-31 04:31 PDT, Andrew Wellington
justin.garcia: review+
Mark Rowe (bdash)
Comment 1 2007-03-07 06:46:19 PST
John Sullivan
Comment 2 2007-03-12 21:40:31 PDT
Actually this was already in radar as<rdar://problem/4044786>. This was caused by the shift to use HTML pages for standalone images.
Andrew Wellington
Comment 3 2007-03-29 22:35:44 PDT
Created attachment 13884 [details] Proposed patch This patch adds a new pasteboard method to copy an image based on the image node and URL and then calls that method when copying in an ImageDocument.
mitz
Comment 4 2007-03-30 04:40:15 PDT
Comment on attachment 13884 [details] Proposed patch Standalone image documents are mutable (via JS) after they're opened. This means that this can deref a 0 pointer or set image to 0: + Node *image = doc->body()->firstChild(); It also means that renderer() here may be 0 or not a RenderImage: + RenderImage* renderer = static_cast<RenderImage*>(imageNode->renderer()); Please don't add another image: + * editing/pasteboard/resources/icon-gold.png: Added. You can use editing/resources/abe.jpg. \ No newline at end of file Please add it. Stars should be next to C++ types: + Document *doc = m_frame->document(); + Node *image = doc->body()->firstChild(); + void writeImage(Node *imageNode, const KURL& url); +void Pasteboard::writeImage(Node *imageNode, const KURL& url) But next to Obj-C object variables' names: + NSArray* types = writableTypesForImage(); r- because in its current form, the patch makes it possible for a website to crash the browser.
Andrew Wellington
Comment 5 2007-03-31 01:03:43 PDT
Created attachment 13901 [details] Proposed Patch 2 Update based on comments from Mitz
Andrew Wellington
Comment 6 2007-03-31 04:31:00 PDT
Comment on attachment 13901 [details] Proposed Patch 2 Submitting an updated patch
Andrew Wellington
Comment 7 2007-03-31 04:31:08 PDT
Created attachment 13906 [details] Proposed patch 3 A few more changes after conversation with Mitz
mitz
Comment 8 2007-04-05 12:18:31 PDT
Comment on attachment 13906 [details] Proposed patch 3 Looks good to me, but I think someone else needs to review it.
Justin Garcia
Comment 9 2007-04-05 13:50:56 PDT
Comment on attachment 13906 [details] Proposed patch 3 I think some code sharing between Pasteboard::writeImage(const HitTestResult&) and writeImage(Node*, KURL) would have been possible, also you probably could have created a public getter for ImageDocument's m_imageElement instead of getting its body's first child, but r=me.
Andrew Wellington
Comment 10 2007-04-09 05:08:35 PDT
Committed in r20802
Note You need to log in before you can comment on or make changes to this bug.