Bug 13328 - Code cleanup in image pasteboard code
Summary: Code cleanup in image pasteboard code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-11 06:29 PDT by Andrew Wellington
Modified: 2007-04-12 10:41 PDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (8.25 KB, patch)
2007-04-11 06:30 PDT, Andrew Wellington
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Wellington 2007-04-11 06:29:38 PDT
The soon-to-be-attached patch addresses some comments from aroben and jgarcia relating to the fix for http://bugs.webkit.org/show_bug.cgi?id=12959

- Consolidate Pasteboard::writeImage(const HitTestResult& result) and Pasteboard::writeImage(Node* imageNode, const KURL& url)
- Create frameContainsCopyableImageDocument in Editor.cpp to create more readable code in Editor::canCopy and Editor::copy
Comment 1 Andrew Wellington 2007-04-11 06:30:40 PDT
Created attachment 14007 [details]
Proposed patch
Comment 2 Darin Adler 2007-04-11 09:37:26 PDT
Comment on attachment 14007 [details]
Proposed patch

+    if (frame->document() && frame->document()->isImageDocument()) {
+        Document* doc = frame->document();

If you're going to have a local variable here, then I suggest declaring it outside the if statement.

Further, I think this function would read better with early exits and a couple more local variables.

It also might be good to make the function return the image element instead of a boolean, allowing us to share slightly more code.

Otherwise looks great. I'm not going to say review+ right now, but I'll probably look back later today.
Comment 3 Andrew Wellington 2007-04-12 05:36:17 PDT
Comment on attachment 14007 [details]
Proposed patch

r20846 by Adam Roben addresses this issue
Comment 4 Adam Roben (:aroben) 2007-04-12 10:41:20 PDT
(In reply to comment #3)
> (From update of attachment 14007 [details] [edit])
> r20846 by Adam Roben addresses this issue
> 

Sorry, I didn't see that this bug had been filed! At least now we know we were thinking along the same lines :-)