[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

sullivan sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:18:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d892aa28c1e7e92ca7ca4a65755cb648ffe24c92
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 13 19:31:15 2002 +0000

    	Various changes to better support the pasteboard.
    
    	* Bookmarks.subproj/IFBookmark.h,
    	* Bookmarks.subproj/IFBookmark.m:
    	(+[IFBookmark bookmarkOfType:]): New method.
    
    	* Bookmarks.subproj/IFBookmarkLeaf.m:
    	(-[IFBookmarkLeaf init]): start out with a non-nil _entry
    	(-[IFBookmarkLeaf setTitle:]): added assert
    	(-[IFBookmarkLeaf setURLString:]): added assert
    
    	* History.subproj/IFURLsWithTitles.h,
    	* History.subproj/IFURLsWithTitles.m:
    	(+[IFURLsWithTitles arrayWithIFURLsWithTitlesPboardType]),
    	(+[IFURLsWithTitles writeURLs:andTitles:toPasteboard:]),
    	(+[IFURLsWithTitles titlesFromPasteboard:]),
    	(+[IFURLsWithTitles URLsFromPasteboard:]):
    	New file with methods for reading/writing pasteboard entry representing
    	a list of URLs with associated titles. Used by Bookmarks window and
    	History window in Alexander.
    
    	* History.subproj/IFWebHistoryPrivate.m:
    	(-[IFWebHistoryPrivate removeEntryForURLString:]): refactored to turn a
    	WEBKITDEBUG into a more-appropriate WEBKIT_ASSERT.
    
    	* WebKit.pbproj/project.pbxproj: Updated for new files.
    
    	Many changes for copy/paste & dragging support, and random little tweaks.
    	- fixed 2927606 -- Should be able to drag items from History window to Bookmarks
    
    	* BookmarksController.m:
    	(-[BookmarksController _droppablePasteboardTypes]),
    	(-[BookmarksController _pasteablePasteboardTypes]):
    	Added IFURLsWithTitlesPboardType and NSURLPboardType.
    
    	(-[BookmarksController _selectedBookmarks]): Renamed from
    	_selectedBookmarksWithoutRedundantDescendants, and removed the descendant-filtering
    	code from here (used by some callers instead).
    	(-[BookmarksController removeSelectedBookmarks:]): Filter results of _selectedBookmarks.
    	(-[BookmarksController outlineView:writeItems:toPasteboard:]): Added support for writing
    	BookmarkDictionaryListPboardType, IFURLsWithTitlesPboardType, NSURLPboardType, and
    	NSStringPboardType.
    	(-[BookmarksController outlineView:validateDrop:proposedItem:proposedChildIndex:]):
    	Split code that sets the drag operation from code that retargets the drop; added support
    	for NSURLPboardType and IFURLsWithTitlesPboardType.
    	(+[BookmarksController _addBookmarksFromURLsWithTitlesOnPasteboard:to:]):
    	New convenience routine.
    	(-[BookmarksController paste:]),
    	(-[BookmarksController outlineView:acceptDrop:item:childIndex:]): Add support for
    	NSURLPboardType and IFURLsWithTitlesPboardType.
    	(-[BookmarksController copy:]): Just calls outlineView:writeItems:toPasteboard: now
    	instead of duplicating code.
    	(-[BookmarksController validateMenuItem:]),
    	(-[BookmarksController validateUserInterfaceItem:]): Removed all code that modified titles
    	of Cut/Copy/Paste/Clear items after realizing that this can't work with the Cocoa
    	responder chain model (no guarantee that the modified titles will be unmodified in other
    	contexts).
    
    	* BrowserWindow.m:
    	(-[BrowserWindow windowWillHandleKeyEvent:]): Returns NO always now; this means that
    	BrowserWindow will no longer try to handle Page Up/Down, arrow keys, etc. We can remove
    	this method entirely (and some other stuff) when 2955757 is addressed.
    
    	* GlobalHistory.m:
    	(-[GlobalHistory _entriesFromMixedItems:collapseDates:]): New convenience method that
    	returns an array of history entries from an array containing a potential mix of history
    	entries and calendar dates.
    	(-[GlobalHistory outlineView:writeItems:toPasteboard:]): New method, writes these types
    	to pasteboard: IFURLsWithTitlesPboardType, NSURLPboardType, NSStringPboardType
    	(-[GlobalHistory _selectedItems]),
    	(-[GlobalHistory removeSelectedItems:]): Broke _selectedItems out of removeSelectedItems.
    	(-[GlobalHistory copy:]): New method, calls outlineView:writeItems:toPasteboard: with
    	the selected items.
    	(-[GlobalHistory validateUserInterfaceItem:]): Enable "Copy" if at least one item is
    	selected.
    
    	* LocationFieldEditor.m:
    	(-[LocationFieldEditor acceptableDragTypes]): Swapped NSURLPboardType and
    	NSStringPboardType so that NSURLPboardType is preferred.
    	(-[LocationFieldEditor concludeDragOperation:]): Use #defines for pasteboard types
    	instead of strings; fix broken use of NSURLPboardType.
    
    	* ResourceProgressEntry.m:
    	(-[ResourceProgressEntry setProgress:]): Improved an error message.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1348 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Bookmarks.subproj/IFBookmark.h b/WebKit/Bookmarks.subproj/IFBookmark.h
index 266562b..7388711 100644
--- a/WebKit/Bookmarks.subproj/IFBookmark.h
+++ b/WebKit/Bookmarks.subproj/IFBookmark.h
@@ -23,6 +23,7 @@ typedef enum {
 }
 
 + (IFBookmark *)bookmarkFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
++ (IFBookmark *)bookmarkOfType:(IFBookmarkType)type;
 
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
 - (NSDictionary *)dictionaryRepresentation;
diff --git a/WebKit/Bookmarks.subproj/IFBookmark.m b/WebKit/Bookmarks.subproj/IFBookmark.m
index e18323e..f1bfb5d 100644
--- a/WebKit/Bookmarks.subproj/IFBookmark.m
+++ b/WebKit/Bookmarks.subproj/IFBookmark.m
@@ -170,6 +170,20 @@ static unsigned _highestUsedID = 0;
     [group _addedBookmark:self];
 }
 
++ (IFBookmark *)bookmarkOfType:(IFBookmarkType)type
+{
+    if (type == IFBookmarkTypeList) {
+        return [[[IFBookmarkList alloc] init] autorelease];
+    } else if (type == IFBookmarkTypeLeaf) {
+        return [[[IFBookmarkLeaf alloc] init] autorelease];
+    } else if (type == IFBookmarkTypeSeparator) {
+        return [[[IFBookmarkSeparator alloc] init] autorelease];
+    }
+
+    return nil;
+}
+
+
 + (IFBookmark *)bookmarkFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group
 {
     NSString *typeString;
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m b/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
index 0f0dfc5..c225182 100644
--- a/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
+++ b/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
@@ -18,6 +18,13 @@
 
 @implementation IFBookmarkLeaf
 
+- (id)init
+{
+    [super init];
+    _entry = [[IFURIEntry alloc] init];
+    return self;
+}
+
 - (id)initWithURLString:(NSString *)URLString
                   title:(NSString *)title
                   image:(NSImage *)image
@@ -25,12 +32,13 @@
 {
     WEBKIT_ASSERT_VALID_ARG (group, group != nil);
     
-    [super init];
+    [self init];
 
     // Since our URLString may not be valid for creating an NSURL object,
     // just hang onto the string separately and don't bother creating
     // an NSURL object for the IFURIEntry.
-    _entry = [[IFURIEntry alloc] initWithURL:nil title:title image:image];
+    [self setTitle:title];
+    [self setImage:image];
     _URLString = [URLString retain];
     [self _setGroup:group];
 
@@ -92,7 +100,8 @@
     if ([title isEqualToString:[self title]]) {
         return;
     }
-    
+
+    WEBKIT_ASSERT (_entry != nil);
     [_entry setTitle:title];
 
     [[self group] _bookmarkDidChange:self];    
@@ -122,6 +131,7 @@
 
 - (void)setURLString:(NSString *)URLString
 {
+    WEBKIT_ASSERT_VALID_ARG (URLString, URLString != nil);
     if ([URLString isEqualToString:_URLString]) {
         return;
     }
diff --git a/WebKit/Bookmarks.subproj/WebBookmark.h b/WebKit/Bookmarks.subproj/WebBookmark.h
index 266562b..7388711 100644
--- a/WebKit/Bookmarks.subproj/WebBookmark.h
+++ b/WebKit/Bookmarks.subproj/WebBookmark.h
@@ -23,6 +23,7 @@ typedef enum {
 }
 
 + (IFBookmark *)bookmarkFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
++ (IFBookmark *)bookmarkOfType:(IFBookmarkType)type;
 
 - (id)initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
 - (NSDictionary *)dictionaryRepresentation;
diff --git a/WebKit/Bookmarks.subproj/WebBookmark.m b/WebKit/Bookmarks.subproj/WebBookmark.m
index e18323e..f1bfb5d 100644
--- a/WebKit/Bookmarks.subproj/WebBookmark.m
+++ b/WebKit/Bookmarks.subproj/WebBookmark.m
@@ -170,6 +170,20 @@ static unsigned _highestUsedID = 0;
     [group _addedBookmark:self];
 }
 
++ (IFBookmark *)bookmarkOfType:(IFBookmarkType)type
+{
+    if (type == IFBookmarkTypeList) {
+        return [[[IFBookmarkList alloc] init] autorelease];
+    } else if (type == IFBookmarkTypeLeaf) {
+        return [[[IFBookmarkLeaf alloc] init] autorelease];
+    } else if (type == IFBookmarkTypeSeparator) {
+        return [[[IFBookmarkSeparator alloc] init] autorelease];
+    }
+
+    return nil;
+}
+
+
 + (IFBookmark *)bookmarkFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group
 {
     NSString *typeString;
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
index 0f0dfc5..c225182 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
@@ -18,6 +18,13 @@
 
 @implementation IFBookmarkLeaf
 
+- (id)init
+{
+    [super init];
+    _entry = [[IFURIEntry alloc] init];
+    return self;
+}
+
 - (id)initWithURLString:(NSString *)URLString
                   title:(NSString *)title
                   image:(NSImage *)image
@@ -25,12 +32,13 @@
 {
     WEBKIT_ASSERT_VALID_ARG (group, group != nil);
     
-    [super init];
+    [self init];
 
     // Since our URLString may not be valid for creating an NSURL object,
     // just hang onto the string separately and don't bother creating
     // an NSURL object for the IFURIEntry.
-    _entry = [[IFURIEntry alloc] initWithURL:nil title:title image:image];
+    [self setTitle:title];
+    [self setImage:image];
     _URLString = [URLString retain];
     [self _setGroup:group];
 
@@ -92,7 +100,8 @@
     if ([title isEqualToString:[self title]]) {
         return;
     }
-    
+
+    WEBKIT_ASSERT (_entry != nil);
     [_entry setTitle:title];
 
     [[self group] _bookmarkDidChange:self];    
@@ -122,6 +131,7 @@
 
 - (void)setURLString:(NSString *)URLString
 {
+    WEBKIT_ASSERT_VALID_ARG (URLString, URLString != nil);
     if ([URLString isEqualToString:_URLString]) {
         return;
     }
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index db2b228..6eb4a22 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,32 @@
+2002-06-13  John Sullivan  <sullivan at apple.com>
+
+	Various changes to better support the pasteboard.
+
+	* Bookmarks.subproj/IFBookmark.h,
+	* Bookmarks.subproj/IFBookmark.m:
+	(+[IFBookmark bookmarkOfType:]): New method.
+
+	* Bookmarks.subproj/IFBookmarkLeaf.m:
+	(-[IFBookmarkLeaf init]): start out with a non-nil _entry
+	(-[IFBookmarkLeaf setTitle:]): added assert
+	(-[IFBookmarkLeaf setURLString:]): added assert
+
+	* History.subproj/IFURLsWithTitles.h,
+	* History.subproj/IFURLsWithTitles.m:
+	(+[IFURLsWithTitles arrayWithIFURLsWithTitlesPboardType]),
+	(+[IFURLsWithTitles writeURLs:andTitles:toPasteboard:]),
+	(+[IFURLsWithTitles titlesFromPasteboard:]),
+	(+[IFURLsWithTitles URLsFromPasteboard:]):
+	New file with methods for reading/writing pasteboard entry representing
+	a list of URLs with associated titles. Used by Bookmarks window and
+	History window in Alexander.
+
+	* History.subproj/IFWebHistoryPrivate.m:
+	(-[IFWebHistoryPrivate removeEntryForURLString:]): refactored to turn a
+	WEBKITDEBUG into a more-appropriate WEBKIT_ASSERT.
+
+	* WebKit.pbproj/project.pbxproj: Updated for new files.
+
 2002-06-13  Kenneth Kocienda  <kocienda at apple.com>
 
         Fixed typo in ChangeLog comment.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index db2b228..6eb4a22 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,32 @@
+2002-06-13  John Sullivan  <sullivan at apple.com>
+
+	Various changes to better support the pasteboard.
+
+	* Bookmarks.subproj/IFBookmark.h,
+	* Bookmarks.subproj/IFBookmark.m:
+	(+[IFBookmark bookmarkOfType:]): New method.
+
+	* Bookmarks.subproj/IFBookmarkLeaf.m:
+	(-[IFBookmarkLeaf init]): start out with a non-nil _entry
+	(-[IFBookmarkLeaf setTitle:]): added assert
+	(-[IFBookmarkLeaf setURLString:]): added assert
+
+	* History.subproj/IFURLsWithTitles.h,
+	* History.subproj/IFURLsWithTitles.m:
+	(+[IFURLsWithTitles arrayWithIFURLsWithTitlesPboardType]),
+	(+[IFURLsWithTitles writeURLs:andTitles:toPasteboard:]),
+	(+[IFURLsWithTitles titlesFromPasteboard:]),
+	(+[IFURLsWithTitles URLsFromPasteboard:]):
+	New file with methods for reading/writing pasteboard entry representing
+	a list of URLs with associated titles. Used by Bookmarks window and
+	History window in Alexander.
+
+	* History.subproj/IFWebHistoryPrivate.m:
+	(-[IFWebHistoryPrivate removeEntryForURLString:]): refactored to turn a
+	WEBKITDEBUG into a more-appropriate WEBKIT_ASSERT.
+
+	* WebKit.pbproj/project.pbxproj: Updated for new files.
+
 2002-06-13  Kenneth Kocienda  <kocienda at apple.com>
 
         Fixed typo in ChangeLog comment.
diff --git a/WebKit/History.subproj/IFURLsWithTitles.h b/WebKit/History.subproj/IFURLsWithTitles.h
new file mode 100644
index 0000000..73d1cef
--- /dev/null
+++ b/WebKit/History.subproj/IFURLsWithTitles.h
@@ -0,0 +1,34 @@
+//
+//  IFURLsWithTitles.h
+//  WebKit
+//
+//  Created by John Sullivan on Wed Jun 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+// Convenience class for getting URLs and associated titles on and off an NSPasteboard
+
+#import <Cocoa/Cocoa.h>
+
+#define IFURLsWithTitlesPboardType	@"IFURLsWithTitlesPboardType"
+
+ at interface IFURLsWithTitles : NSObject
+
+// Writes parallel arrays of URLs and titles to the pasteboard. These items can be retrieved by
+// calling URLsFromPasteboard and titlesFromPasteboard. URLs must consist of NSURL objects.
+// titles must consist of NSStrings, or be nil. If titles is nil, or if titles is a different
+// length than URLs, empty strings will be used for all titles. If URLs is nil, this method
+// returns without doing anything. You must declare an IFURLsWithTitlesPboardType data type
+// for pasteboard before invoking this method, or it will return without doing anything.
++(void)writeURLs:(NSArray *)URLs andTitles:(NSArray *)titles toPasteboard:(NSPasteboard *)pasteboard;
+
+// Reads an array of NSURLs off the pasteboard. Returns nil if pasteboard does not contain
+// data of type IFURLsWithTitlesPboardType. This array consists of the URLs that correspond to
+// the titles returned from titlesFromPasteboard.
++(NSArray *)URLsFromPasteboard:(NSPasteboard *)pasteboard;
+
+// Reads an array of NSStrings off the pasteboard. Returns nil if pasteboard does not contain
+// data of type IFURLsWithTitlesPboardType. This array consists of the titles that correspond to
+// the URLs returned from URLsFromPasteboard.
++(NSArray *)titlesFromPasteboard:(NSPasteboard *)pasteboard;
+
+ at end
diff --git a/WebKit/History.subproj/IFURLsWithTitles.m b/WebKit/History.subproj/IFURLsWithTitles.m
new file mode 100644
index 0000000..ee487c3
--- /dev/null
+++ b/WebKit/History.subproj/IFURLsWithTitles.m
@@ -0,0 +1,85 @@
+//
+//  IFURLsWithTitles.m
+//  WebBrowser
+//
+//  Created by John Sullivan on Wed Jun 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFURLsWithTitles.h"
+#import <WebKit/WebKitDebug.h>
+
+ at implementation IFURLsWithTitles
+
++ (NSArray *)arrayWithIFURLsWithTitlesPboardType
+{
+    // Make a canned array so we don't construct it on the fly over and over.
+    static NSArray *cannedArray = nil;
+
+    if (cannedArray == nil) {
+        cannedArray = [[NSArray arrayWithObject:IFURLsWithTitlesPboardType] retain];
+    }
+
+    return cannedArray;
+}
+
++(void)writeURLs:(NSArray *)URLs andTitles:(NSArray *)titles toPasteboard:(NSPasteboard *)pasteboard
+{
+    NSMutableArray *URLStrings;
+    NSMutableArray *titlesOrEmptyStrings;
+    unsigned index, count;
+
+    count = [URLs count];
+    if (count == 0) {
+        return;
+    }
+
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return;
+    }
+
+    if (count != [titles count]) {
+        titles = nil;
+    }
+
+    URLStrings = [NSMutableArray arrayWithCapacity:count];
+    titlesOrEmptyStrings = [NSMutableArray arrayWithCapacity:count];
+    for (index = 0; index < count; ++index) {
+        [URLStrings addObject:[[URLs objectAtIndex:index] absoluteString]];
+        [titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [titles objectAtIndex:index]];
+    }
+
+    [pasteboard setPropertyList:[NSArray arrayWithObjects:URLStrings, titlesOrEmptyStrings, nil]
+                        forType:IFURLsWithTitlesPboardType];
+}
+
++(NSArray *)titlesFromPasteboard:(NSPasteboard *)pasteboard
+{
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return nil;
+    }
+
+    return [[pasteboard propertyListForType:IFURLsWithTitlesPboardType] objectAtIndex:1];
+}
+
++(NSArray *)URLsFromPasteboard:(NSPasteboard *)pasteboard
+{
+    NSArray *URLStrings;
+    NSMutableArray *URLs;
+    unsigned index, count;
+    
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return nil;
+    }
+
+    URLStrings = [[pasteboard propertyListForType:IFURLsWithTitlesPboardType] objectAtIndex:0];
+    count = [URLStrings count];
+    URLs = [NSMutableArray arrayWithCapacity:count];
+    for (index = 0; index < count; ++index) {
+        [URLs addObject:[NSURL URLWithString:[URLStrings objectAtIndex:index]]];
+    }
+
+    return URLs;
+}
+
+ at end
diff --git a/WebKit/History.subproj/IFWebHistoryPrivate.m b/WebKit/History.subproj/IFWebHistoryPrivate.m
index 2645024..c752aec 100644
--- a/WebKit/History.subproj/IFWebHistoryPrivate.m
+++ b/WebKit/History.subproj/IFWebHistoryPrivate.m
@@ -105,8 +105,10 @@
 
 - (BOOL)removeEntryForURLString: (NSString *)urlString
 {
+    NSMutableArray *entriesForDate;
     IFURIEntry *entry;
     int dateIndex;
+    BOOL foundDate;
 
     entry = [_urlDictionary objectForKey: urlString];
     if (entry == nil) {
@@ -115,18 +117,17 @@
 
     [_urlDictionary removeObjectForKey: urlString];
 
-    if ([self findIndex: &dateIndex forDay: [entry lastVisitedDate]]) {
-        NSMutableArray *entriesForDate = [_entriesByDate objectAtIndex: dateIndex];
-        [entriesForDate removeObject: entry];
+    foundDate = [self findIndex: &dateIndex forDay: [entry lastVisitedDate]];
 
-        // remove this date entirely if there are no other entries on it
-        if ([entriesForDate count] == 0) {
-            [_entriesByDate removeObjectAtIndex: dateIndex];
-            [_datesWithEntries removeObjectAtIndex: dateIndex];
-        }
-    } else {
-        WEBKITDEBUG("'%s' was in url dictionary but its date %s was not in date index",
-              DEBUG_OBJECT([entry url]), DEBUG_OBJECT([entry lastVisitedDate]));
+    WEBKIT_ASSERT (foundDate);
+    
+    entriesForDate = [_entriesByDate objectAtIndex: dateIndex];
+    [entriesForDate removeObject: entry];
+
+    // remove this date entirely if there are no other entries on it
+    if ([entriesForDate count] == 0) {
+        [_entriesByDate removeObjectAtIndex: dateIndex];
+        [_datesWithEntries removeObjectAtIndex: dateIndex];
     }
 
     return YES;
diff --git a/WebKit/History.subproj/WebHistoryPrivate.m b/WebKit/History.subproj/WebHistoryPrivate.m
index 2645024..c752aec 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.m
+++ b/WebKit/History.subproj/WebHistoryPrivate.m
@@ -105,8 +105,10 @@
 
 - (BOOL)removeEntryForURLString: (NSString *)urlString
 {
+    NSMutableArray *entriesForDate;
     IFURIEntry *entry;
     int dateIndex;
+    BOOL foundDate;
 
     entry = [_urlDictionary objectForKey: urlString];
     if (entry == nil) {
@@ -115,18 +117,17 @@
 
     [_urlDictionary removeObjectForKey: urlString];
 
-    if ([self findIndex: &dateIndex forDay: [entry lastVisitedDate]]) {
-        NSMutableArray *entriesForDate = [_entriesByDate objectAtIndex: dateIndex];
-        [entriesForDate removeObject: entry];
+    foundDate = [self findIndex: &dateIndex forDay: [entry lastVisitedDate]];
 
-        // remove this date entirely if there are no other entries on it
-        if ([entriesForDate count] == 0) {
-            [_entriesByDate removeObjectAtIndex: dateIndex];
-            [_datesWithEntries removeObjectAtIndex: dateIndex];
-        }
-    } else {
-        WEBKITDEBUG("'%s' was in url dictionary but its date %s was not in date index",
-              DEBUG_OBJECT([entry url]), DEBUG_OBJECT([entry lastVisitedDate]));
+    WEBKIT_ASSERT (foundDate);
+    
+    entriesForDate = [_entriesByDate objectAtIndex: dateIndex];
+    [entriesForDate removeObject: entry];
+
+    // remove this date entirely if there are no other entries on it
+    if ([entriesForDate count] == 0) {
+        [_entriesByDate removeObjectAtIndex: dateIndex];
+        [_datesWithEntries removeObjectAtIndex: dateIndex];
     }
 
     return YES;
diff --git a/WebKit/History.subproj/WebURLsWithTitles.h b/WebKit/History.subproj/WebURLsWithTitles.h
new file mode 100644
index 0000000..73d1cef
--- /dev/null
+++ b/WebKit/History.subproj/WebURLsWithTitles.h
@@ -0,0 +1,34 @@
+//
+//  IFURLsWithTitles.h
+//  WebKit
+//
+//  Created by John Sullivan on Wed Jun 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+// Convenience class for getting URLs and associated titles on and off an NSPasteboard
+
+#import <Cocoa/Cocoa.h>
+
+#define IFURLsWithTitlesPboardType	@"IFURLsWithTitlesPboardType"
+
+ at interface IFURLsWithTitles : NSObject
+
+// Writes parallel arrays of URLs and titles to the pasteboard. These items can be retrieved by
+// calling URLsFromPasteboard and titlesFromPasteboard. URLs must consist of NSURL objects.
+// titles must consist of NSStrings, or be nil. If titles is nil, or if titles is a different
+// length than URLs, empty strings will be used for all titles. If URLs is nil, this method
+// returns without doing anything. You must declare an IFURLsWithTitlesPboardType data type
+// for pasteboard before invoking this method, or it will return without doing anything.
++(void)writeURLs:(NSArray *)URLs andTitles:(NSArray *)titles toPasteboard:(NSPasteboard *)pasteboard;
+
+// Reads an array of NSURLs off the pasteboard. Returns nil if pasteboard does not contain
+// data of type IFURLsWithTitlesPboardType. This array consists of the URLs that correspond to
+// the titles returned from titlesFromPasteboard.
++(NSArray *)URLsFromPasteboard:(NSPasteboard *)pasteboard;
+
+// Reads an array of NSStrings off the pasteboard. Returns nil if pasteboard does not contain
+// data of type IFURLsWithTitlesPboardType. This array consists of the titles that correspond to
+// the URLs returned from URLsFromPasteboard.
++(NSArray *)titlesFromPasteboard:(NSPasteboard *)pasteboard;
+
+ at end
diff --git a/WebKit/History.subproj/WebURLsWithTitles.m b/WebKit/History.subproj/WebURLsWithTitles.m
new file mode 100644
index 0000000..ee487c3
--- /dev/null
+++ b/WebKit/History.subproj/WebURLsWithTitles.m
@@ -0,0 +1,85 @@
+//
+//  IFURLsWithTitles.m
+//  WebBrowser
+//
+//  Created by John Sullivan on Wed Jun 12 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFURLsWithTitles.h"
+#import <WebKit/WebKitDebug.h>
+
+ at implementation IFURLsWithTitles
+
++ (NSArray *)arrayWithIFURLsWithTitlesPboardType
+{
+    // Make a canned array so we don't construct it on the fly over and over.
+    static NSArray *cannedArray = nil;
+
+    if (cannedArray == nil) {
+        cannedArray = [[NSArray arrayWithObject:IFURLsWithTitlesPboardType] retain];
+    }
+
+    return cannedArray;
+}
+
++(void)writeURLs:(NSArray *)URLs andTitles:(NSArray *)titles toPasteboard:(NSPasteboard *)pasteboard
+{
+    NSMutableArray *URLStrings;
+    NSMutableArray *titlesOrEmptyStrings;
+    unsigned index, count;
+
+    count = [URLs count];
+    if (count == 0) {
+        return;
+    }
+
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return;
+    }
+
+    if (count != [titles count]) {
+        titles = nil;
+    }
+
+    URLStrings = [NSMutableArray arrayWithCapacity:count];
+    titlesOrEmptyStrings = [NSMutableArray arrayWithCapacity:count];
+    for (index = 0; index < count; ++index) {
+        [URLStrings addObject:[[URLs objectAtIndex:index] absoluteString]];
+        [titlesOrEmptyStrings addObject:(titles == nil) ? @"" : [titles objectAtIndex:index]];
+    }
+
+    [pasteboard setPropertyList:[NSArray arrayWithObjects:URLStrings, titlesOrEmptyStrings, nil]
+                        forType:IFURLsWithTitlesPboardType];
+}
+
++(NSArray *)titlesFromPasteboard:(NSPasteboard *)pasteboard
+{
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return nil;
+    }
+
+    return [[pasteboard propertyListForType:IFURLsWithTitlesPboardType] objectAtIndex:1];
+}
+
++(NSArray *)URLsFromPasteboard:(NSPasteboard *)pasteboard
+{
+    NSArray *URLStrings;
+    NSMutableArray *URLs;
+    unsigned index, count;
+    
+    if ([pasteboard availableTypeFromArray:[self arrayWithIFURLsWithTitlesPboardType]] == nil) {
+        return nil;
+    }
+
+    URLStrings = [[pasteboard propertyListForType:IFURLsWithTitlesPboardType] objectAtIndex:0];
+    count = [URLStrings count];
+    URLs = [NSMutableArray arrayWithCapacity:count];
+    for (index = 0; index < count; ++index) {
+        [URLs addObject:[NSURL URLWithString:[URLStrings objectAtIndex:index]]];
+    }
+
+    return URLs;
+}
+
+ at end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 016c5ec..e30899f 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -252,6 +252,7 @@
 				35081DAF02B6D4F50ACA2ACA,
 				F508946B02B71D59018A9CD4,
 				F5FBAB9102B88CBF01FF6074,
+				F5E0A77002B8FEE401C1A525,
 			);
 			isa = PBXHeadersBuildPhase;
 		};
@@ -326,6 +327,7 @@
 				35081DAD02B6D4E40ACA2ACA,
 				F508946C02B71D59018A9CD4,
 				F5FBAB9202B88CBF01FF6074,
+				F5E0A77102B8FEE401C1A525,
 			);
 			isa = PBXSourcesBuildPhase;
 		};
@@ -478,6 +480,8 @@
 				39446080020F50ED0ECA1767,
 				39446081020F50ED0ECA1767,
 				39446082020F50ED0ECA1767,
+				F5E0A76E02B8FEE401C1A525,
+				F5E0A76F02B8FEE401C1A525,
 				F520FB190221DEFD01C1A525,
 				F520FB1A0221DEFD01C1A525,
 				F5B92B820223191D01C1A525,
@@ -1845,6 +1849,31 @@
 			settings = {
 			};
 		};
+		F5E0A76E02B8FEE401C1A525 = {
+			isa = PBXFileReference;
+			path = IFURLsWithTitles.h;
+			refType = 4;
+		};
+		F5E0A76F02B8FEE401C1A525 = {
+			isa = PBXFileReference;
+			path = IFURLsWithTitles.m;
+			refType = 4;
+		};
+		F5E0A77002B8FEE401C1A525 = {
+			fileRef = F5E0A76E02B8FEE401C1A525;
+			isa = PBXBuildFile;
+			settings = {
+				ATTRIBUTES = (
+					Public,
+				);
+			};
+		};
+		F5E0A77102B8FEE401C1A525 = {
+			fileRef = F5E0A76F02B8FEE401C1A525;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F5E638620265FC0D01000102 = {
 			isa = PBXFileReference;
 			name = plugin_document_template.html;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list