Summary: | REGRESSION: Edit -> Copy not enabled on standalone images | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Matt Lilek <dev+webkit> | ||||||||
Component: | New Bugs | Assignee: | 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
Matt Lilek
2007-03-03 12:26:29 PST
Actually this was already in radar as<rdar://problem/4044786>. This was caused by the shift to use HTML pages for standalone images. 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.
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.
Created attachment 13901 [details]
Proposed Patch 2
Update based on comments from Mitz
Comment on attachment 13901 [details]
Proposed Patch 2
Submitting an updated patch
Created attachment 13906 [details]
Proposed patch 3
A few more changes after conversation with Mitz
Comment on attachment 13906 [details]
Proposed patch 3
Looks good to me, but I think someone else needs to review it.
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.
Committed in r20802 |