diff options
author | Ben Murdoch <benm@google.com> | 2009-08-11 17:01:47 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-11 18:21:02 +0100 |
commit | 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch) | |
tree | 2943df35f62d885c89d01063cc528dd73b480fea /WebKit/mac/WebCoreSupport/WebContextMenuClient.mm | |
parent | 7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff) | |
download | external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2 |
Merge in WebKit r47029.
Diffstat (limited to 'WebKit/mac/WebCoreSupport/WebContextMenuClient.mm')
-rw-r--r-- | WebKit/mac/WebCoreSupport/WebContextMenuClient.mm | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm index 6b5ad14..639f3c1 100644 --- a/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm +++ b/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm @@ -28,6 +28,7 @@ #import "WebContextMenuClient.h" +#import "WebDelegateImplementationCaching.h" #import "WebElementDictionary.h" #import "WebFrame.h" #import "WebFrameInternal.h" @@ -42,6 +43,7 @@ #import "WebViewInternal.h" #import <WebCore/ContextMenu.h> #import <WebCore/KURL.h> +#import <WebCore/RuntimeApplicationChecks.h> #import <WebKit/DOMPrivate.h> using namespace WebCore; @@ -60,11 +62,6 @@ void WebContextMenuClient::contextMenuDestroyed() delete this; } -static BOOL isAppleMail(void) -{ - return [[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.mail"]; -} - static BOOL isPreVersion3Client(void) { static BOOL preVersion3Client = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_3_0_CONTEXT_MENU_TAGS); @@ -102,7 +99,7 @@ static NSMutableArray *fixMenusToSendToOldClients(NSMutableArray *defaultMenuIte if (!preVersion3Client) return savedItems; - BOOL isMail = isAppleMail(); + BOOL isMail = applicationIsAppleMail(); for (unsigned i = 0; i < defaultItemsCount; ++i) { NSMenuItem *item = [defaultMenuItems objectAtIndex:i]; int tag = [item tag]; @@ -216,6 +213,31 @@ static void fixMenusReceivedFromOldClients(NSMutableArray *newMenuItems, NSMutab modernTag = WebMenuItemTagLeftToRight; else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagRightToLeft]]) modernTag = WebMenuItemTagRightToLeft; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCorrectSpellingAutomatically]]) + modernTag = WebMenuItemTagCorrectSpellingAutomatically; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSubstitutionsMenu]]) + modernTag = WebMenuItemTagSubstitutionsMenu; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:true]] + || [title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagShowSubstitutions:false]]) + modernTag = WebMenuItemTagShowSubstitutions; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartCopyPaste]]) + modernTag = WebMenuItemTagSmartCopyPaste; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartQuotes]]) + modernTag = WebMenuItemTagSmartQuotes; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartDashes]]) + modernTag = WebMenuItemTagSmartDashes; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagSmartLinks]]) + modernTag = WebMenuItemTagSmartLinks; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagTextReplacement]]) + modernTag = WebMenuItemTagTextReplacement; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagTransformationsMenu]]) + modernTag = WebMenuItemTagTransformationsMenu; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagMakeUpperCase]]) + modernTag = WebMenuItemTagMakeUpperCase; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagMakeLowerCase]]) + modernTag = WebMenuItemTagMakeLowerCase; + else if ([title isEqualToString:[[WebViewFactory sharedFactory] contextMenuItemTagCapitalize]]) + modernTag = WebMenuItemTagCapitalize; else { // We don't expect WebMenuItemTagOther for any items other than the ones we explicitly handle. // There's nothing to prevent an app from applying this tag, but they are supposed to only @@ -316,6 +338,11 @@ void WebContextMenuClient::lookUpInDictionary(Frame* frame) [htmlView _lookUpInDictionaryFromMenu:nil]; } +bool WebContextMenuClient::isSpeaking() +{ + return [NSApp isSpeaking]; +} + void WebContextMenuClient::speak(const String& string) { [NSApp speakString:[[(NSString*)string copy] autorelease]]; @@ -323,5 +350,5 @@ void WebContextMenuClient::speak(const String& string) void WebContextMenuClient::stopSpeaking() { - [NSApp stopSpeaking]; + [NSApp stopSpeaking:nil]; } |