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

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:27:13 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 1c2e64c9661077ba3a8e9b4094395ed99fe59211
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 25 01:34:26 2002 +0000

    	Added implmentations for a few context menu items.
    
            * WebView.subproj/WebController.h:
            * WebView.subproj/WebDefaultContextMenuHandler.h:
            * WebView.subproj/WebDefaultContextMenuHandler.m:
            (-[WebDefaultContextMenuHandler dealloc]):
            (-[WebDefaultContextMenuHandler contextMenuItemsForElement:defaultMenuItems:]):
            (-[WebDefaultContextMenuHandler validateUserInterfaceItem:]):
            (-[WebDefaultContextMenuHandler openNewWindowWithURL:]):
            (-[WebDefaultContextMenuHandler openLinkInNewWindow:]):
            (-[WebDefaultContextMenuHandler copyLinkToClipboard:]):
            (-[WebDefaultContextMenuHandler openImageInNewWindow:]):
            (-[WebDefaultContextMenuHandler copyImageToClipboard:]):
            (-[WebDefaultContextMenuHandler reloadImage:]):
            (-[WebDefaultContextMenuHandler openFrameInNewWindow:]):
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView menuForEvent:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1665 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f1c6581..d85b4f1 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2002-07-24  Chris Blumenberg  <cblu at apple.com>
+
+	Added implmentations for a few context menu items.
+
+        * WebView.subproj/WebController.h:
+        * WebView.subproj/WebDefaultContextMenuHandler.h:
+        * WebView.subproj/WebDefaultContextMenuHandler.m:
+        (-[WebDefaultContextMenuHandler dealloc]):
+        (-[WebDefaultContextMenuHandler contextMenuItemsForElement:defaultMenuItems:]):
+        (-[WebDefaultContextMenuHandler validateUserInterfaceItem:]):
+        (-[WebDefaultContextMenuHandler openNewWindowWithURL:]):
+        (-[WebDefaultContextMenuHandler openLinkInNewWindow:]):
+        (-[WebDefaultContextMenuHandler copyLinkToClipboard:]):
+        (-[WebDefaultContextMenuHandler openImageInNewWindow:]):
+        (-[WebDefaultContextMenuHandler copyImageToClipboard:]):
+        (-[WebDefaultContextMenuHandler reloadImage:]):
+        (-[WebDefaultContextMenuHandler openFrameInNewWindow:]):
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView menuForEvent:]):
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Removed vestigal locationChangeHandler ivar.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index f1c6581..d85b4f1 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-07-24  Chris Blumenberg  <cblu at apple.com>
+
+	Added implmentations for a few context menu items.
+
+        * WebView.subproj/WebController.h:
+        * WebView.subproj/WebDefaultContextMenuHandler.h:
+        * WebView.subproj/WebDefaultContextMenuHandler.m:
+        (-[WebDefaultContextMenuHandler dealloc]):
+        (-[WebDefaultContextMenuHandler contextMenuItemsForElement:defaultMenuItems:]):
+        (-[WebDefaultContextMenuHandler validateUserInterfaceItem:]):
+        (-[WebDefaultContextMenuHandler openNewWindowWithURL:]):
+        (-[WebDefaultContextMenuHandler openLinkInNewWindow:]):
+        (-[WebDefaultContextMenuHandler copyLinkToClipboard:]):
+        (-[WebDefaultContextMenuHandler openImageInNewWindow:]):
+        (-[WebDefaultContextMenuHandler copyImageToClipboard:]):
+        (-[WebDefaultContextMenuHandler reloadImage:]):
+        (-[WebDefaultContextMenuHandler openFrameInNewWindow:]):
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView menuForEvent:]):
+
 2002-07-24  Richard Williamson (Local)  <rjw at apple.com>
 
         Removed vestigal locationChangeHandler ivar.
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index c85a3d9..f54c20a 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -118,7 +118,7 @@
 @protocol WebContextMenuHandler <NSObject>
 // Returns the array of NSMenuItems that will be displayed in the context menu 
 // for the dictionary representation of the clicked element.
-- (NSArray *)contextMenuItemsForElementInfo: (NSDictionary *)elementInfo  defaultMenuItems: (NSArray *)menuItems;
+- (NSArray *)contextMenuItemsForElement: (NSDictionary *)element  defaultMenuItems: (NSArray *)menuItems;
 @end
 
 
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
index c0b1814..7efbdd4 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.h
@@ -12,7 +12,7 @@
 @protocol WebContextMenuHandler;
 
 @interface WebDefaultContextMenuHandler : NSObject <WebContextMenuHandler> {
-    NSDictionary *currentInfo;
+    NSDictionary *element;
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 4c4cda3..329792a 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -14,7 +14,7 @@
 
 - (void)dealloc
 {
-    [currentInfo release];
+    [element release];
     [super dealloc];
 }
 
@@ -26,17 +26,18 @@
     [menuItem release];
 }
 
-- (NSArray *)contextMenuItemsForElementInfo: (NSDictionary *)elementInfo  defaultMenuItems: (NSArray *)defaultMenuItems
+- (NSArray *)contextMenuItemsForElement: (NSDictionary *)theElement  defaultMenuItems: (NSArray *)defaultMenuItems
 {
     NSMutableArray *menuItems = [NSMutableArray array];
     NSURL *linkURL, *imageURL;
     
-    currentInfo = [elementInfo retain];
+    element = [theElement retain];
 
-    linkURL = [currentInfo objectForKey:WebContextLinkURL];
+    linkURL = [element objectForKey:WebContextLinkURL];
 
     if(linkURL){
-        [self addMenuItemWithTitle:NSLocalizedString(@"Open Link in New Window", @"Open in New Window context menu item") 				            action:@selector(openInNewWindow:)
+    
+        [self addMenuItemWithTitle:NSLocalizedString(@"Open Link in New Window", @"Open in New Window context menu item") 				            action:@selector(openLinkInNewWindow:)
                            toArray:menuItems];
         
         [self addMenuItemWithTitle:NSLocalizedString(@"Download Link to Disk", @"Download Link to Disk context menu item") 				    action:@selector(downloadLinkToDisk:)
@@ -44,18 +45,18 @@
 
         [self addMenuItemWithTitle:NSLocalizedString(@"Copy Link to Clipboard", @"Copy Link to Clipboard context menu item") 				    action:@selector(copyLinkToClipboard:)
                            toArray:menuItems];
-
-        [self addMenuItemWithTitle:NSLocalizedString(@"Add Link to Bookmarks", @"Add Link to Bookmarks context menu item") 				    action:@selector(addLinkToBookmarks:)
-                           toArray:menuItems];
     }
 
-    imageURL = [currentInfo objectForKey:WebContextImageURL];
+    imageURL = [element objectForKey:WebContextImageURL];
 
     if(imageURL){
+    
         if(linkURL){
             [menuItems addObject:[NSMenuItem separatorItem]];
         }
-        [self addMenuItemWithTitle:NSLocalizedString(@"Open Image in New Window", @"Open Image in New Window context menu item") 		            action:@selector(openImageInNewWindow:)
+        
+        [self addMenuItemWithTitle:NSLocalizedString(@"Open Image in New Window", @"Open Image in New Window context menu item") 		             
+                            action:@selector(openImageInNewWindow:)
                            toArray:menuItems];
         
         [self addMenuItemWithTitle:NSLocalizedString(@"Download Image To Disk", @"Download Image To Disk context menu item") 				    action:@selector(downloadImageToDisk:)
@@ -64,28 +65,25 @@
         [self addMenuItemWithTitle:NSLocalizedString(@"Copy Image to Clipboard", @"Copy Image to Clipboard context menu item") 				    action:@selector(copyImageToClipboard:)
                            toArray:menuItems];
         
-        [self addMenuItemWithTitle:NSLocalizedString(@"Reload Image", @"Reload Image context menu item") 				                    action:@selector(reloadImage:)
+        [self addMenuItemWithTitle:NSLocalizedString(@"Reload Image", @"Reload Image context menu item") 				                    
+                            action:@selector(reloadImage:)
                            toArray:menuItems];
     }
 
     if(!imageURL && !linkURL){
-        WebFrame *webFrame = [currentInfo objectForKey:WebContextFrame];
+    
+        WebFrame *webFrame = [element objectForKey:WebContextFrame];
 
         if([[webFrame dataSource] isMainDocument]){
-            [self addMenuItemWithTitle:NSLocalizedString(@"View Source", @"View Source context menu item") 				                        action:@selector(viewSource:)
-                               toArray:menuItems];
-            
-            [self addMenuItemWithTitle:NSLocalizedString(@"Save Page", @"Save Page context menu item")
-                                action:@selector(savePage:)
+            [self addMenuItemWithTitle:NSLocalizedString(@"View Source", @"View Source context menu item") 				                        
+                                action:@selector(viewSource:)
                                toArray:menuItems];
         }else{
             [self addMenuItemWithTitle:NSLocalizedString(@"Open Frame in New Window", @"Open Frame in New Window context menu item") 				action:@selector(openFrameInNewWindow:)
                                toArray:menuItems];
             
-            [self addMenuItemWithTitle:NSLocalizedString(@"View Frame Source", @"View Frame Source context menu item") 				                action:@selector(viewSource:)
-                               toArray:menuItems];
-            
-            [self addMenuItemWithTitle:NSLocalizedString(@"Save Frame", @"Save Frame context menu item") 				                        action:@selector(savePage:)
+            [self addMenuItemWithTitle:NSLocalizedString(@"View Frame Source", @"View Frame Source context menu item") 				                
+                                action:@selector(viewSource:)
                                toArray:menuItems];
         }
     }
@@ -93,4 +91,59 @@
     return menuItems;
 }
 
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
+{
+    return YES;
+}
+
+- (void)openNewWindowWithURL:(NSURL *)URL
+{
+    WebFrame *webFrame = [element objectForKey:WebContextFrame];
+    WebController *controller = [webFrame controller];
+    [[controller windowContext] openNewWindowWithURL:URL];
+}
+
+- (void)openLinkInNewWindow:(id)sender
+{
+    [self openNewWindowWithURL:[element objectForKey:WebContextLinkURL]];
+}
+
+- (void)copyLinkToClipboard:(id)sender
+{
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    NSURL *URL = [element objectForKey:WebContextLinkURL];
+    
+    [pasteboard declareTypes:[NSArray arrayWithObjects:NSURLPboardType, NSStringPboardType, nil] owner:nil];
+    [pasteboard setString:[URL absoluteString] forType:NSStringPboardType];
+    [URL writeToPasteboard:pasteboard];
+}
+
+- (void)openImageInNewWindow:(id)sender
+{
+    [self openNewWindowWithURL:[element objectForKey:WebContextImageURL]];
+}
+
+- (void)copyImageToClipboard:(id)sender
+{
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    NSData *tiff = [[element objectForKey:WebContextImage] TIFFRepresentation];
+    
+    [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
+    [pasteboard setData:tiff forType:NSTIFFPboardType];
+}
+
+- (void)reloadImage:(id)sender
+{
+
+}
+
+- (void)openFrameInNewWindow:(id)sender
+{
+    WebFrame *webFrame = [element objectForKey:WebContextFrame];
+    WebDataSource *dataSource = [webFrame dataSource];
+    NSURL *URL = [dataSource wasRedirected] ? [dataSource redirectedURL] : [dataSource inputURL];
+    [self openNewWindowWithURL:URL];
+}
+
+
 @end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.h b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.h
index c0b1814..7efbdd4 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.h
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.h
@@ -12,7 +12,7 @@
 @protocol WebContextMenuHandler;
 
 @interface WebDefaultContextMenuHandler : NSObject <WebContextMenuHandler> {
-    NSDictionary *currentInfo;
+    NSDictionary *element;
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
index 4c4cda3..329792a 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
@@ -14,7 +14,7 @@
 
 - (void)dealloc
 {
-    [currentInfo release];
+    [element release];
     [super dealloc];
 }
 
@@ -26,17 +26,18 @@
     [menuItem release];
 }
 
-- (NSArray *)contextMenuItemsForElementInfo: (NSDictionary *)elementInfo  defaultMenuItems: (NSArray *)defaultMenuItems
+- (NSArray *)contextMenuItemsForElement: (NSDictionary *)theElement  defaultMenuItems: (NSArray *)defaultMenuItems
 {
     NSMutableArray *menuItems = [NSMutableArray array];
     NSURL *linkURL, *imageURL;
     
-    currentInfo = [elementInfo retain];
+    element = [theElement retain];
 
-    linkURL = [currentInfo objectForKey:WebContextLinkURL];
+    linkURL = [element objectForKey:WebContextLinkURL];
 
     if(linkURL){
-        [self addMenuItemWithTitle:NSLocalizedString(@"Open Link in New Window", @"Open in New Window context menu item") 				            action:@selector(openInNewWindow:)
+    
+        [self addMenuItemWithTitle:NSLocalizedString(@"Open Link in New Window", @"Open in New Window context menu item") 				            action:@selector(openLinkInNewWindow:)
                            toArray:menuItems];
         
         [self addMenuItemWithTitle:NSLocalizedString(@"Download Link to Disk", @"Download Link to Disk context menu item") 				    action:@selector(downloadLinkToDisk:)
@@ -44,18 +45,18 @@
 
         [self addMenuItemWithTitle:NSLocalizedString(@"Copy Link to Clipboard", @"Copy Link to Clipboard context menu item") 				    action:@selector(copyLinkToClipboard:)
                            toArray:menuItems];
-
-        [self addMenuItemWithTitle:NSLocalizedString(@"Add Link to Bookmarks", @"Add Link to Bookmarks context menu item") 				    action:@selector(addLinkToBookmarks:)
-                           toArray:menuItems];
     }
 
-    imageURL = [currentInfo objectForKey:WebContextImageURL];
+    imageURL = [element objectForKey:WebContextImageURL];
 
     if(imageURL){
+    
         if(linkURL){
             [menuItems addObject:[NSMenuItem separatorItem]];
         }
-        [self addMenuItemWithTitle:NSLocalizedString(@"Open Image in New Window", @"Open Image in New Window context menu item") 		            action:@selector(openImageInNewWindow:)
+        
+        [self addMenuItemWithTitle:NSLocalizedString(@"Open Image in New Window", @"Open Image in New Window context menu item") 		             
+                            action:@selector(openImageInNewWindow:)
                            toArray:menuItems];
         
         [self addMenuItemWithTitle:NSLocalizedString(@"Download Image To Disk", @"Download Image To Disk context menu item") 				    action:@selector(downloadImageToDisk:)
@@ -64,28 +65,25 @@
         [self addMenuItemWithTitle:NSLocalizedString(@"Copy Image to Clipboard", @"Copy Image to Clipboard context menu item") 				    action:@selector(copyImageToClipboard:)
                            toArray:menuItems];
         
-        [self addMenuItemWithTitle:NSLocalizedString(@"Reload Image", @"Reload Image context menu item") 				                    action:@selector(reloadImage:)
+        [self addMenuItemWithTitle:NSLocalizedString(@"Reload Image", @"Reload Image context menu item") 				                    
+                            action:@selector(reloadImage:)
                            toArray:menuItems];
     }
 
     if(!imageURL && !linkURL){
-        WebFrame *webFrame = [currentInfo objectForKey:WebContextFrame];
+    
+        WebFrame *webFrame = [element objectForKey:WebContextFrame];
 
         if([[webFrame dataSource] isMainDocument]){
-            [self addMenuItemWithTitle:NSLocalizedString(@"View Source", @"View Source context menu item") 				                        action:@selector(viewSource:)
-                               toArray:menuItems];
-            
-            [self addMenuItemWithTitle:NSLocalizedString(@"Save Page", @"Save Page context menu item")
-                                action:@selector(savePage:)
+            [self addMenuItemWithTitle:NSLocalizedString(@"View Source", @"View Source context menu item") 				                        
+                                action:@selector(viewSource:)
                                toArray:menuItems];
         }else{
             [self addMenuItemWithTitle:NSLocalizedString(@"Open Frame in New Window", @"Open Frame in New Window context menu item") 				action:@selector(openFrameInNewWindow:)
                                toArray:menuItems];
             
-            [self addMenuItemWithTitle:NSLocalizedString(@"View Frame Source", @"View Frame Source context menu item") 				                action:@selector(viewSource:)
-                               toArray:menuItems];
-            
-            [self addMenuItemWithTitle:NSLocalizedString(@"Save Frame", @"Save Frame context menu item") 				                        action:@selector(savePage:)
+            [self addMenuItemWithTitle:NSLocalizedString(@"View Frame Source", @"View Frame Source context menu item") 				                
+                                action:@selector(viewSource:)
                                toArray:menuItems];
         }
     }
@@ -93,4 +91,59 @@
     return menuItems;
 }
 
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
+{
+    return YES;
+}
+
+- (void)openNewWindowWithURL:(NSURL *)URL
+{
+    WebFrame *webFrame = [element objectForKey:WebContextFrame];
+    WebController *controller = [webFrame controller];
+    [[controller windowContext] openNewWindowWithURL:URL];
+}
+
+- (void)openLinkInNewWindow:(id)sender
+{
+    [self openNewWindowWithURL:[element objectForKey:WebContextLinkURL]];
+}
+
+- (void)copyLinkToClipboard:(id)sender
+{
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    NSURL *URL = [element objectForKey:WebContextLinkURL];
+    
+    [pasteboard declareTypes:[NSArray arrayWithObjects:NSURLPboardType, NSStringPboardType, nil] owner:nil];
+    [pasteboard setString:[URL absoluteString] forType:NSStringPboardType];
+    [URL writeToPasteboard:pasteboard];
+}
+
+- (void)openImageInNewWindow:(id)sender
+{
+    [self openNewWindowWithURL:[element objectForKey:WebContextImageURL]];
+}
+
+- (void)copyImageToClipboard:(id)sender
+{
+    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
+    NSData *tiff = [[element objectForKey:WebContextImage] TIFFRepresentation];
+    
+    [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
+    [pasteboard setData:tiff forType:NSTIFFPboardType];
+}
+
+- (void)reloadImage:(id)sender
+{
+
+}
+
+- (void)openFrameInNewWindow:(id)sender
+{
+    WebFrame *webFrame = [element objectForKey:WebContextFrame];
+    WebDataSource *dataSource = [webFrame dataSource];
+    NSURL *URL = [dataSource wasRedirected] ? [dataSource redirectedURL] : [dataSource inputURL];
+    [self openNewWindowWithURL:URL];
+}
+
+
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 6dfafb9..6feff21 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -221,11 +221,11 @@
     elementInfo = [self _elementInfoAtPoint:point];
 
     defaultContextMenuHandler = [[self _controller] _defaultContextMenuHandler];
-    defaultMenuItems = [defaultContextMenuHandler contextMenuItemsForElementInfo: elementInfo  defaultMenuItems: nil];
+    defaultMenuItems = [defaultContextMenuHandler contextMenuItemsForElement: elementInfo  defaultMenuItems: nil];
     contextMenuHandler = [[self _controller] contextMenuHandler];
 
     if(contextMenuHandler){
-        menuItems = [contextMenuHandler contextMenuItemsForElementInfo: elementInfo  defaultMenuItems: defaultMenuItems];
+        menuItems = [contextMenuHandler contextMenuItemsForElement: elementInfo  defaultMenuItems: defaultMenuItems];
     } else {
         menuItems = defaultMenuItems;
     }
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index c85a3d9..f54c20a 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -118,7 +118,7 @@
 @protocol WebContextMenuHandler <NSObject>
 // Returns the array of NSMenuItems that will be displayed in the context menu 
 // for the dictionary representation of the clicked element.
-- (NSArray *)contextMenuItemsForElementInfo: (NSDictionary *)elementInfo  defaultMenuItems: (NSArray *)menuItems;
+- (NSArray *)contextMenuItemsForElement: (NSDictionary *)element  defaultMenuItems: (NSArray *)menuItems;
 @end
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list