[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 07:21:37 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 000c03a579a008b39811b3fe4d55a98889d534f3
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 24 00:52:04 2003 +0000
WebKit:
Made WebTextView use the same format for context menus as the rest of WebKit.
Implemented "Copy" context menu.
Reviewed by john.
* English.lproj/Localizable.strings:
* WebView.subproj/WebControllerPrivate.m:
(-[WebController _menuForElement:]): tweak.
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultContextMenuDelegate contextMenuItemsForElement:defaultMenuItems:]): added "Copy" context menu.
* WebView.subproj/WebImageView.m:
(-[WebImageView menuForEvent:]): added asserts
* WebView.subproj/WebTextView.m:
(-[WebTextView menuForEvent:]): implemented
WebBrowser:
Implemented context menus "Copy", "Google Search" and "Go To Address" context menus for selected text.
Reviewed by john.
* BrowserWindowController.h:
* BrowserWindowController.m:
(-[BrowserWindowController searchForString:]): new, does what chooseSearchString but takes a string
(-[BrowserWindowController chooseSearchString:]): call searchForString
* ContextMenuHandler.m:
(-[ContextMenuHandler contextMenuItemsForElement:defaultMenuItems:]): added "Copy", "Google Search" and "Go To Address"
(-[ContextMenuHandler search:]): calls searchForString
(-[ContextMenuHandler goToAddress:]): does what it says
* English.lproj/Localizable.strings:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 0f87354..08595c2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,20 @@
+2003-01-23 Chris Blumenberg <cblu at apple.com>
+
+ Made WebTextView use the same format for context menus as the rest of WebKit.
+ Implemented "Copy" context menu.
+
+ Reviewed by john.
+
+ * English.lproj/Localizable.strings:
+ * WebView.subproj/WebControllerPrivate.m:
+ (-[WebController _menuForElement:]): tweak.
+ * WebView.subproj/WebDefaultContextMenuDelegate.m:
+ (-[WebDefaultContextMenuDelegate contextMenuItemsForElement:defaultMenuItems:]): added "Copy" context menu.
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView menuForEvent:]): added asserts
+ * WebView.subproj/WebTextView.m:
+ (-[WebTextView menuForEvent:]): implemented
+
2003-01-23 Maciej Stachowiak <mjs at apple.com>
Reviewed by Darin.
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index daa5e1c..0558b90 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index 1e763d0..169e700 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -306,17 +306,17 @@
NSMenu *menu = nil;
unsigned i;
- if(_private->contextMenuDelegate){
+ if (_private->contextMenuDelegate) {
menuItems = [_private->contextMenuDelegate contextMenuItemsForElement:element
defaultMenuItems:defaultMenuItems];
} else {
menuItems = defaultMenuItems;
}
- if(menuItems && [menuItems count] > 0){
+ if (menuItems && [menuItems count] > 0) {
menu = [[[NSMenu alloc] init] autorelease];
- for(i=0; i<[menuItems count]; i++){
+ for (i=0; i<[menuItems count]; i++) {
[menu addItem:[menuItems objectAtIndex:i]];
}
}
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index d1e0229..29b7b27 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -12,6 +12,7 @@
#import <WebKit/WebDefaultContextMenuDelegate.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebNSPasteboardExtras.h>
+#import <WebKit/WebView.h>
#import <WebKit/WebWindowOperationsDelegate.h>
#import <WebFoundation/WebHTTPResourceRequest.h>
@@ -47,16 +48,19 @@
if(linkURL){
if([WebResourceHandle canInitWithRequest:[WebResourceRequest requestWithURL:linkURL]]){
- [[self class] addMenuItemWithTitle:UI_STRING("Open Link in New Window", "Open in New Window context menu item") action:@selector(openLinkInNewWindow:)
+ [[self class] addMenuItemWithTitle:UI_STRING("Open Link in New Window", "Open in New Window context menu item")
+ action:@selector(openLinkInNewWindow:)
target:self
toArray:menuItems];
- [[self class] addMenuItemWithTitle:UI_STRING("Download Link to Disk", "Download Link to Disk context menu item") action:@selector(downloadLinkToDisk:)
+ [[self class] addMenuItemWithTitle:UI_STRING("Download Link to Disk", "Download Link to Disk context menu item")
+ action:@selector(downloadLinkToDisk:)
target:self
toArray:menuItems];
}
- [[self class] addMenuItemWithTitle:UI_STRING("Copy Link to Clipboard", "Copy Link to Clipboard context menu item") action:@selector(copyLinkToClipboard:)
+ [[self class] addMenuItemWithTitle:UI_STRING("Copy Link to Clipboard", "Copy Link to Clipboard context menu item")
+ action:@selector(copyLinkToClipboard:)
target:self
toArray:menuItems];
}
@@ -74,23 +78,33 @@
target:self
toArray:menuItems];
- [[self class] addMenuItemWithTitle:UI_STRING("Download Image To Disk", "Download Image To Disk context menu item") action:@selector(downloadImageToDisk:)
+ [[self class] addMenuItemWithTitle:UI_STRING("Download Image To Disk", "Download Image To Disk context menu item")
+ action:@selector(downloadImageToDisk:)
target:self
toArray:menuItems];
- [[self class] addMenuItemWithTitle:UI_STRING("Copy Image to Clipboard", "Copy Image to Clipboard context menu item") action:@selector(copyImageToClipboard:)
+ [[self class] addMenuItemWithTitle:UI_STRING("Copy Image to Clipboard", "Copy Image to Clipboard context menu item")
+ action:@selector(copyImageToClipboard:)
target:self
toArray:menuItems];
}
- if(!imageURL && !linkURL){
-
- WebFrame *webFrame = [element objectForKey:WebElementFrameKey];
+ if (!imageURL && !linkURL) {
- if(webFrame != [[webFrame controller] mainFrame]){
- [[self class] addMenuItemWithTitle:UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item") action:@selector(openFrameInNewWindow:)
- target:self
+ if ([[element objectForKey:WebElementIsSelectedTextKey] boolValue]) {
+ [[self class] addMenuItemWithTitle:UI_STRING("Copy", "Copy context menu item")
+ action:@selector(copy:)
+ target:nil
toArray:menuItems];
+ } else {
+ WebFrame *webFrame = [element objectForKey:WebElementFrameKey];
+
+ if(webFrame != [[webFrame controller] mainFrame]){
+ [[self class] addMenuItemWithTitle:UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item")
+ action:@selector(openFrameInNewWindow:)
+ target:self
+ toArray:menuItems];
+ }
}
}
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index e3bafc0..cca5e79 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -15,6 +15,8 @@
#import <WebKit/WebView.h>
#import <WebKit/WebViewPrivate.h>
+#import <WebFoundation/WebAssertions.h>
+
@implementation WebImageView
- (void)initialize
@@ -149,12 +151,17 @@
- (NSMenu *)menuForEvent:(NSEvent *)theEvent
{
WebView *webView = [self _web_parentWebView];
- WebController *controller = [self controller];
+ WebController *controller = [webView controller];
+ WebFrame *frame = [controller frameForView:webView];
+
+ ASSERT(frame);
+ ASSERT(controller);
NSDictionary *element = [NSDictionary dictionaryWithObjectsAndKeys:
[representation image], WebElementImageKey,
[representation URL], WebElementImageURLKey,
- [controller frameForView:webView], WebElementFrameKey, nil];
+ [NSNumber numberWithBool:NO], WebElementIsSelectedTextKey,
+ frame, WebElementFrameKey, nil];
return [controller _menuForElement:element];
}
diff --git a/WebKit/WebView.subproj/WebTextView.m b/WebKit/WebView.subproj/WebTextView.m
index 5fa8fd7..a28f428 100644
--- a/WebKit/WebView.subproj/WebTextView.m
+++ b/WebKit/WebView.subproj/WebTextView.m
@@ -5,11 +5,15 @@
#import <WebKit/WebTextView.h>
+#import <WebFoundation/WebAssertions.h>
#import <WebFoundation/WebResourceResponse.h>
+#import <WebKit/WebControllerPrivate.h>
#import <WebKit/WebDataSource.h>
#import <WebKit/WebDocument.h>
+#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebPreferences.h>
+#import <WebKit/WebView.h>
@implementation WebTextView
@@ -170,4 +174,24 @@
[[self nextResponder] keyUp:event];
}
+- (NSMenu *)menuForEvent:(NSEvent *)theEvent
+{
+ // Calling super causes unselected clicked text to be selected.
+ [super menuForEvent:theEvent];
+
+ WebView *webView = [self _web_parentWebView];
+ WebController *controller = [webView controller];
+ WebFrame *frame = [controller frameForView:webView];
+
+ ASSERT(frame);
+ ASSERT(controller);
+
+ BOOL hasSelection = ([self selectedRange].location != NSNotFound && [self selectedRange].length > 0);
+ NSDictionary *element = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:hasSelection], WebElementIsSelectedTextKey,
+ frame, WebElementFrameKey, nil];
+
+ return [controller _menuForElement:element];
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 1e763d0..169e700 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -306,17 +306,17 @@
NSMenu *menu = nil;
unsigned i;
- if(_private->contextMenuDelegate){
+ if (_private->contextMenuDelegate) {
menuItems = [_private->contextMenuDelegate contextMenuItemsForElement:element
defaultMenuItems:defaultMenuItems];
} else {
menuItems = defaultMenuItems;
}
- if(menuItems && [menuItems count] > 0){
+ if (menuItems && [menuItems count] > 0) {
menu = [[[NSMenu alloc] init] autorelease];
- for(i=0; i<[menuItems count]; i++){
+ for (i=0; i<[menuItems count]; i++) {
[menu addItem:[menuItems objectAtIndex:i]];
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list