Bug 58842

Summary: Dropping a file in a WKView (WebKit2) doesn't load the file
Product: WebKit Reporter: Enrica Casucci <enrica>
Component: WebKit2Assignee: Enrica Casucci <enrica>
Status: RESOLVED FIXED    
Severity: Normal CC: jeffm
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows 7   
Attachments:
Description Flags
Patch mjs: review+

Description Enrica Casucci 2011-04-18 15:30:16 PDT
Dragging a local .html into the current page doesn't show a "+" green circle nor does it allow dragging and dropping the site. This does work however when dragged and dropped to the toolbar.

Repro steps:
1. Launch Safari on Windows
2. Drag and drop a local .html file into into current page.
--Result: Local .html file is not displayed. Blue '+ Copy' displayed when hovering local .html file over current page instead of expected green '+'.
--Note: Drag and drop of local .html files into bookmarks toolbar functions as expected.

<rdar://problem/8514409>
Comment 1 Enrica Casucci 2011-04-18 15:39:50 PDT
Created attachment 90104 [details]
Patch
Comment 2 Jeff Miller 2011-04-18 15:49:49 PDT
Comment on attachment 90104 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=90104&action=review

> Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:447
> +    RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringData.charactersWithNullTermination(), wcslen(stringData.charactersWithNullTermination())));

Can't you just do: RetainPtr<CFStringRef> pathAsCFString(AdoptCF, stringData.createCFString());
Comment 3 Jeff Miller 2011-04-18 15:56:33 PDT
(In reply to comment #2)
> (From update of attachment 90104 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=90104&action=review
> 
> > Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:447
> > +    RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringData.charactersWithNullTermination(), wcslen(stringData.charactersWithNullTermination())));
> 
> Can't you just do: RetainPtr<CFStringRef> pathAsCFString(AdoptCF, stringData.createCFString());

Ignore that comment, I see that the problem you're addressing is that there is an extra null at the end, and createCFString() is using String::length(), which would be wrong.
Comment 4 Maciej Stachowiak 2011-04-18 15:57:02 PDT
Comment on attachment 90104 [details]
Patch

r=me but please consider Jeff's suggestion when landing.
Comment 5 Enrica Casucci 2011-04-18 16:06:46 PDT
In his last comment, Jeff told me to ignore his previous comment. In fact what I'm removing is the use of String.length() to get rid of the extra 0 at the end.
Thanks for the review.
Comment 6 Enrica Casucci 2011-04-18 16:09:44 PDT
http://trac.webkit.org/changeset/84203