Bug 8276

Summary: REGRESSION (NativeTextField): Pasting a Finder item into a text field results in a file: URL being pasted instead of just the file name
Product: WebKit Reporter: mitz
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal Keywords: Regression
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Paste as plain text when targeting a text field
none
Same code patch, with a change log and a manual test for this bug and bug 8283
darin: review+
Contents of resources/plain-text-paste none

Description mitz 2006-04-09 05:38:23 PDT
Steps to reproduce:
1) Select an item in the Finder
2) Choose Edit > Copy "<name of selected item>"
3) In Safari, go to http://www.google.com/
4) Choose Edit > Paste

Expected results:
Only the name of the item copied from the finder should be pasted into the field.

Actual results:
A file: URL for the copied item is pasted into the field.
Comment 1 Adele Peterson 2006-04-10 13:44:52 PDT
While this is a native text field regression, we think the symptom is mild, so we're moving it to P2.
Comment 2 mitz 2006-04-11 05:52:13 PDT
Created attachment 7642 [details]
Paste as plain text when targeting a text field

-[WebHTMLView _plainTextFromPasteboard:] is based on observing the behavior of AppKit text fields. This patch also addresses bug 8283.
Comment 3 Darin Adler 2006-04-11 08:10:23 PDT
Comment on attachment 7642 [details]
Paste as plain text when targeting a text field

Looks fine. I'm not sure about the part about enabling the pasteAsRichText: selector, but frankly I don't understand the value of that selector anyway, nor do I think it's used in any common case.

r=me
Comment 4 mitz 2006-04-11 15:16:42 PDT
Comment on attachment 7642 [details]
Paste as plain text when targeting a text field

Thanks to Justin I've noticed that this patch makes dragging a link into a text field result in the link's text being pasted instead of the URL. This is actually behavior that would be nice to have in rich text (pasting an anchor) but not in fields.
Comment 5 mitz 2006-04-12 13:01:33 PDT
(In reply to comment #4)
> [T]his patch makes dragging a link into a text
> field result in the link's text being pasted instead of the URL.

I was wrong (again!), it doesn't, since the NSStringPboardType contains the URL in that case. So I think the patch is fine, but I don't know how to make a test for it.
Comment 6 mitz 2006-04-18 12:07:20 PDT
Created attachment 7806 [details]
Same code patch, with a change log and a manual test for this bug and bug 8283
Comment 7 mitz 2006-04-18 12:09:05 PDT
Created attachment 7808 [details]
Contents of resources/plain-text-paste
Comment 8 Darin Adler 2006-04-19 19:34:12 PDT
Comment on attachment 7806 [details]
Same code patch, with a change log and a manual test for this bug and bug 8283

r=me again
Comment 9 mitz 2006-09-10 15:11:58 PDT
The resources for the test weren't checked in properly. Their resource forks and Finder metadata need to be preserved for the test to work. I think the right way to do it is to use /Developer/Tools/SplitForks on the directory and then check in the AppleDouble pairs.
Comment 10 Mark Rowe (bdash) 2006-10-05 15:30:16 PDT
Fixed in r16827.