Commit 53987a4c authored by sullivan's avatar sullivan

Reviewed by Beth Dakin

        
        - fixed <rdar://problem/4239051> Sometimes "Copy Link" in Safari results in a 
        URL on the pasteboard with no usable "title"

        * History/WebURLsWithTitles.m:
        (+[WebURLsWithTitles writeURLs:andTitles:toPasteboard:]):
        trim whitespace from titles that are put on pasteboard. This leaves an empty string
        for the title in cases where there's no displayed text, like an image in an <a> element
        that happens to have whitespace in the source, e.g. <a href="foo"> <img whatever></a>



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 246d3448
2006-03-17 John Sullivan <sullivan@apple.com>
Reviewed by Beth Dakin
- fixed <rdar://problem/4239051> Sometimes "Copy Link" in Safari results in a
URL on the pasteboard with no usable "title"
* History/WebURLsWithTitles.m:
(+[WebURLsWithTitles writeURLs:andTitles:toPasteboard:]):
trim whitespace from titles that are put on pasteboard. This leaves an empty string
for the title in cases where there's no displayed text, like an image in an <a> element
that happens to have whitespace in the source, e.g. <a href="foo"> <img whatever></a>
2006-03-17 Darin Adler <darin@apple.com>
- missing bit of my check-in yesterday
......
......@@ -29,6 +29,7 @@
#import "WebURLsWithTitles.h"
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebKitNSStringExtras.h>
@implementation WebURLsWithTitles
......@@ -67,7 +68,7 @@ +(void)writeURLs:(NSArray *)URLs andTitles:(NSArray *)titles toPasteboard:(NSPas
titlesOrEmptyStrings = [NSMutableArray arrayWithCapacity:count];
for (index = 0; index < count; ++index) {
[URLStrings addObject:[[URLs objectAtIndex:index] _web_userVisibleString]];
[titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [titles objectAtIndex:index]];
[titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [[titles objectAtIndex:index] _webkit_stringByTrimmingWhitespace]];
}
[pasteboard setPropertyList:[NSArray arrayWithObjects:URLStrings, titlesOrEmptyStrings, nil]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment