[webkit-reviews] review requested: [Bug 10725] Image data in from RTFD clipboard data thrown away : [Attachment 10528] patch 3

bugzilla-request-daemon at opendarwin.org bugzilla-request-daemon at opendarwin.org
Wed Sep 13 08:37:34 PDT 2006


Graham Dennis <Graham.Dennis at gmail.com> has asked  for review:
Bug 10725: Image data in from RTFD clipboard data thrown away
http://bugzilla.opendarwin.org/show_bug.cgi?id=10725

Attachment 10528: patch 3
http://bugzilla.opendarwin.org/attachment.cgi?id=10528&action=edit

------- Additional Comments from Graham Dennis <Graham.Dennis at gmail.com>
Even when applying the previous patch, images pasted in from RTFD data would
not be displayed in WebKit. The reason for this is that WebCore tries to load
the applewebdata URLs for the images before the resources have been added to
the WebUnarchivingState, and because it is an AppKit-private method that parses
the RTFD data and creates the document fragment, we cannot add the resources to
the WebUnarchivingState until after WebCore has parsed the document fragment
and attempted to load the applewebdata URLs.

My method for fixing this is to delay loading applewebdata URLs while the
AppKit method is parsing the RTFD data, and only load these URLs after the
WebResources have been added to the WebUnarchivingState.

Fixing this caused an exception in Safari because it uses the
_webDataRequestExternalURL of the webdata URL as the key in a dictionary for
the activity window. So I changed _webDataRequestExternalURL to not return nil,
and to return a more sensible default for displaying in the activity window.

To create a Layout test for this patch I had to load the appropriate data into
the NSPasteboard, and the only way I could see how to do this was to use the
objective-c plugin for DumpRenderTree and call various methods to load the data
and put it into NSPasteboard. However, I needed to call the method
-[NSPasteboard declareTypes:owner:] which requires an NSArray argument.
Unfortunately, NSArray's are bridged to JS Array's, and when I try and pass a
JS Array to the objc method, it receives a WebScriptObject instead of an
NSArray, and NSPasteboard doesn't like that. To work around this, I added a
convenience method to the DumpRenderTreePasteboard that accepts an NSString
instead of an NSArray.

I added two test cases for this patch (one for TIFF pasteboard data and one for
RTFD pasteboard data) because I came across bug #10314 by trying to paste TIFF
pasteboard data, and the patch to 10314 was committed without a layout test.



More information about the webkit-reviews mailing list