Title: [175306] branches/safari-600.3-branch/Source/WebKit

Diff

Modified: branches/safari-600.3-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2014-10-29 04:55:46 UTC (rev 175306)
@@ -161,6 +161,8 @@
 		934C11670D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 934C11660D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h */; };
 		934C4A910F01406C009372C0 /* WebNSObjectExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 934C4A900F01406C009372C0 /* WebNSObjectExtras.mm */; };
 		934C4AA00F0141F7009372C0 /* WebResourceInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 934C4A9F0F0141F7009372C0 /* WebResourceInternal.h */; };
+		935D44E419F9AFF000FB5306 /* WebActionMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 935D44E219F9AFF000FB5306 /* WebActionMenuController.h */; };
+		935D44E519F9AFF000FB5306 /* WebActionMenuController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */; };
 		936A2DE80FD2D08000D312DB /* WebTextCompletionController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 936A2DE70FD2D08000D312DB /* WebTextCompletionController.mm */; };
 		936A2DEA0FD2D08400D312DB /* WebTextCompletionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 936A2DE90FD2D08400D312DB /* WebTextCompletionController.h */; };
 		9391F275121B38BD00EBF7E8 /* WebFrameNetworkingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9391F273121B38BD00EBF7E8 /* WebFrameNetworkingContext.h */; };
@@ -701,6 +703,8 @@
 		934C11660D8710BB00C32ABD /* WebDynamicScrollBarsViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDynamicScrollBarsViewInternal.h; sourceTree = "<group>"; };
 		934C4A900F01406C009372C0 /* WebNSObjectExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNSObjectExtras.mm; sourceTree = "<group>"; };
 		934C4A9F0F0141F7009372C0 /* WebResourceInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceInternal.h; sourceTree = "<group>"; };
+		935D44E219F9AFF000FB5306 /* WebActionMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebActionMenuController.h; sourceTree = "<group>"; };
+		935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebActionMenuController.mm; sourceTree = "<group>"; };
 		936A2DE70FD2D08000D312DB /* WebTextCompletionController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebTextCompletionController.mm; sourceTree = "<group>"; };
 		936A2DE90FD2D08400D312DB /* WebTextCompletionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTextCompletionController.h; sourceTree = "<group>"; };
 		9391F273121B38BD00EBF7E8 /* WebFrameNetworkingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameNetworkingContext.h; sourceTree = "<group>"; };
@@ -1290,6 +1294,8 @@
 				F52CA6BD02DF9D0F018635CA /* HTML */,
 				51E94C0706C02CA300A9B09E /* PDF */,
 				A10C1D79182030190036883A /* ios */,
+				935D44E219F9AFF000FB5306 /* WebActionMenuController.h */,
+				935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */,
 				8373435A0624EE0D00F3B289 /* WebArchive.h */,
 				8373435B0624EE0D00F3B289 /* WebArchive.mm */,
 				44BB8B131241A022001E3A22 /* WebArchiveInternal.h */,
@@ -1728,6 +1734,7 @@
 				9398104B0824BF01008DF038 /* WebDataSource.h in Headers */,
 				658A40960A14853B005E6987 /* WebDataSourceInternal.h in Headers */,
 				9398104C0824BF01008DF038 /* WebDataSourcePrivate.h in Headers */,
+				935D44E419F9AFF000FB5306 /* WebActionMenuController.h in Headers */,
 				9398104E0824BF01008DF038 /* WebDefaultContextMenuDelegate.h in Headers */,
 				9398108D0824BF01008DF038 /* WebDefaultEditingDelegate.h in Headers */,
 				9398104F0824BF01008DF038 /* WebDefaultPolicyDelegate.h in Headers */,
@@ -2245,6 +2252,7 @@
 				A5687BDB135B791A0074CBCB /* WebNodeHighlighter.mm in Sources */,
 				1C68F672095B5FC100C2984E /* WebNodeHighlightView.mm in Sources */,
 				A10C1D611820300E0036883A /* SearchPopupMenuIOS.cpp in Sources */,
+				935D44E519F9AFF000FB5306 /* WebActionMenuController.mm in Sources */,
 				A10C1D6C1820300E0036883A /* WebFrameIOS.mm in Sources */,
 				312E2FE614E48182007CCA18 /* WebNotification.mm in Sources */,
 				31C11A6F1476552E0049A4CC /* WebNotificationClient.mm in Sources */,

Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog	2014-10-29 04:55:46 UTC (rev 175306)
@@ -1,3 +1,47 @@
+2014-10-28  Lucas Forschler  <lforsch...@apple.com>
+
+        Merge r175182
+
+    2014-10-24  Beth Dakin  <bda...@apple.com>
+
+            WebKit1 should support action menus
+            https://bugs.webkit.org/show_bug.cgi?id=138032
+
+            Reviewed by Tim Horton.
+
+            This patch adds basic support for action menus and adds actions for links.
+
+            Helper class takes care of all of the action menu work. WebView will forward the 
+            prepareForMenu: message, and then the helper class takes it from there.
+            * WebView/WebActionMenuController.h: Added.
+            * WebView/WebActionMenuController.mm: Added.
+            (-[WebActionMenuController webViewClosed]):
+            (-[WebActionMenuController prepareForMenu:withEvent:]):
+
+            Selectors for link actions.
+            (-[WebActionMenuController _openURLFromActionMenu:]):
+            (-[WebActionMenuController _addToReadingListFromActionMenu:]):
+            (-[WebActionMenuController _elementBoundingBoxFromDOMElement:]):
+            (-[WebActionMenuController _quickLookURLFromActionMenu:]):
+            (-[WebActionMenuController _createActionMenuItemForTag:withHitTestResult:]):
+            (webKitBundleImageNamed):
+            (-[WebActionMenuController _defaultMenuItemsForLink:]):
+            (-[WebActionMenuController _defaultMenuItemsForHitTestResult:]):
+
+            Tags for the action menu items.
+            * WebView/WebUIDelegatePrivate.h:
+            * WebView/WebView.mm:
+
+            Set the action menu if possible and create the controller.
+            (-[WebView _initWithFrame:frameName:groupName:]):
+            (-[WebView _close]):
+            (-[WebView prepareForMenu:withEvent:]):
+
+            WebViewData stores the WebActionMenuHelper
+            * WebView/WebViewData.h:
+            * WebView/WebViewData.mm:
+            (-[WebViewPrivate dealloc]):
+
 2014-10-28  Dana Burkart  <dburk...@apple.com>
 
         Merge r175132. <rdar://problem/18753175>

Copied: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h (from rev 175182, trunk/Source/WebKit/mac/WebView/WebActionMenuController.h) (0 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h	                        (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h	2014-10-29 04:55:46 UTC (rev 175306)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@class WebView;
+
+@interface WebActionMenuController : NSObject {
+@private
+    WebView *_webView;
+}
+
+- (id)initWithWebView:(WebView *)webView;
+- (void)webViewClosed;
+- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
+
+@end

Copied: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (from rev 175182, trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm) (0 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm	                        (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-10-29 04:55:46 UTC (rev 175306)
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebActionMenuController.h"
+
+#import "DOMElementInternal.h"
+#import "DOMNodeInternal.h"
+#import "WebUIDelegatePrivate.h"
+#import "WebViewInternal.h"
+#import <WebCore/Element.h>
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/NSViewSPI.h>
+#import <WebCore/SoftLinking.h>
+#import <objc/objc-class.h>
+#import <objc/objc.h>
+
+SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
+SOFT_LINK_CLASS(QuickLookUI, QLPreviewBubble)
+
+@class QLPreviewBubble;
+@interface NSObject (WKQLPreviewBubbleDetails)
+@property (copy) NSArray * controls;
+@property NSSize maximumSize;
+@property NSRectEdge preferredEdge;
+@property (retain) IBOutlet NSWindow* parentWindow;
+- (void)showPreviewItem:(id)previewItem itemFrame:(NSRect)frame;
+- (void)setAutomaticallyCloseWithMask:(NSEventMask)autocloseMask filterMask:(NSEventMask)filterMask block:(void (^)(void))block;
+@end
+
+using namespace WebCore;
+
+@implementation WebActionMenuController
+
+- (id)initWithWebView:(WebView *)webView
+{
+    if (!(self = [super init]))
+        return nil;
+    _webView = webView;
+
+    return self;
+}
+
+- (void)webViewClosed
+{
+    _webView = nil;
+}
+
+- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
+{
+    if (!_webView)
+        return;
+
+    NSMenu *actionMenu = _webView.actionMenu;
+    if (menu != actionMenu)
+        return;
+
+    [actionMenu removeAllItems];
+
+    NSDictionary *hitTestResult = [_webView elementAtPoint:[_webView convertPoint:event.locationInWindow fromView:nil]];
+
+    // FIXME: We should support API for clients to customize the menu items.
+    NSArray *menuItems = [self _defaultMenuItemsForHitTestResult:hitTestResult];
+
+    for (NSMenuItem *item in menuItems)
+        [actionMenu addItem:item];
+}
+
+- (void)_openURLFromActionMenu:(id)sender
+{
+    if (!_webView)
+        return;
+
+    NSURL *url = ""
+    if (!url)
+        return;
+
+    ASSERT([url isKindOfClass:[NSURL class]]);
+
+    [[NSWorkspace sharedWorkspace] openURL:url];
+}
+
+- (void)_addToReadingListFromActionMenu:(id)sender
+{
+    if (!_webView)
+        return;
+
+    NSURL *url = ""
+    if (!url)
+        return;
+
+    ASSERT([url isKindOfClass:[NSURL class]]);
+
+    NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameAddToSafariReadingList];
+    [service performWithItems:@[ url ]];
+}
+
+- (NSRect)_elementBoundingBoxFromDOMElement:(DOMElement *)domElement
+{
+    if (!domElement)
+        return NSZeroRect;
+
+    Node* node = core(domElement);
+    Frame* frame = node->document().frame();
+    if (!frame)
+        return NSZeroRect;
+
+    FrameView* view = frame->view();
+    if (!view)
+        return NSZeroRect;
+
+    return view->contentsToWindow(node->pixelSnappedBoundingBox());
+}
+
+- (void)_quickLookURLFromActionMenu:(id)sender
+{
+    if (!_webView)
+        return;
+
+    NSDictionary *hitTestResult = sender.representedObject;
+    if (!hitTestResult)
+        return;
+
+    ASSERT([hitTestResult isKindOfClass:[NSDictionary class]]);
+
+    NSURL *url = "" objectForKey:WebElementLinkURLKey];
+    if (!url)
+        return;
+
+    DOMElement *domElement = [hitTestResult objectForKey:WebElementDOMNodeKey];
+    if (!domElement)
+        return;
+
+    NSRect itemFrame = [_webView convertRect:[self _elementBoundingBoxFromDOMElement:domElement] toView:nil];
+    NSSize maximumPreviewSize = NSMakeSize(_webView.bounds.size.width * 0.75, _webView.bounds.size.height * 0.75);
+
+    RetainPtr<QLPreviewBubble> bubble = adoptNS([[getQLPreviewBubbleClass() alloc] init]);
+    [bubble setParentWindow:_webView.window];
+    [bubble setMaximumSize:maximumPreviewSize];
+    [bubble setPreferredEdge:NSMaxYEdge];
+    [bubble setControls:@[ ]];
+    NSEventMask filterMask = NSAnyEventMask & ~(NSAppKitDefinedMask | NSSystemDefinedMask | NSApplicationDefinedMask | NSMouseEnteredMask | NSMouseExitedMask);
+    NSEventMask autocloseMask = NSLeftMouseDownMask | NSRightMouseDownMask | NSKeyDownMask;
+    [bubble setAutomaticallyCloseWithMask:autocloseMask filterMask:filterMask block:[bubble] {
+        [bubble close];
+    }];
+    [bubble showPreviewItem:url itemFrame:itemFrame];
+}
+
+- (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag withHitTestResult:(NSDictionary *)hitTestResult
+{
+    SEL selector = nullptr;
+    NSString *title = nil;
+    NSImage *image = nil;
+    id representedObject = nil;
+
+    // FIXME: We should localize these strings.
+    switch (tag) {
+    case WebActionMenuItemTagOpenLinkInDefaultBrowser:
+        selector = @selector(_openURLFromActionMenu:);
+        title = @"Open";
+        image = webKitBundleImageNamed(@"OpenInNewWindowTemplate");
+        representedObject = [hitTestResult objectForKey:WebElementLinkURLKey];
+        break;
+
+    case WebActionMenuItemTagPreviewLink:
+        selector = @selector(_quickLookURLFromActionMenu:);
+        title = @"Preview";
+        image = [NSImage imageNamed:NSImageNameQuickLookTemplate];
+        representedObject = hitTestResult;
+        break;
+
+    case WebActionMenuItemTagAddLinkToSafariReadingList:
+        selector = @selector(_addToReadingListFromActionMenu:);
+        title = @"Add to Safari Reading List";
+        image = [NSImage imageNamed:NSImageNameBookmarksTemplate];
+        representedObject = [hitTestResult objectForKey:WebElementLinkURLKey];
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+        return nil;
+    }
+
+    RetainPtr<NSMenuItem> item = adoptNS([[NSMenuItem alloc] initWithTitle:title action:selector keyEquivalent:@""]);
+    [item setImage:image];
+    [item setTarget:self];
+    [item setTag:tag];
+    [item setRepresentedObject:representedObject];
+    return item;
+}
+
+static NSImage *webKitBundleImageNamed(NSString *name)
+{
+    return [[NSBundle bundleForClass:NSClassFromString(@"WKView")] imageForResource:name];
+}
+
+- (NSArray *)_defaultMenuItemsForLink:(NSDictionary *)hitTestResult
+{
+    NSURL *url = "" objectForKey:WebElementLinkURLKey];
+    if (!url)
+        return @[ ];
+
+    if (!WebCore::protocolIsInHTTPFamily([url absoluteString]))
+        return @[ ];
+
+    RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser withHitTestResult:hitTestResult];
+    RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink withHitTestResult:hitTestResult];
+    RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList withHitTestResult:hitTestResult];
+
+    return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
+}
+
+- (NSArray *)_defaultMenuItemsForHitTestResult:(NSDictionary *)hitTestResult
+{
+    NSURL *url = "" objectForKey:WebElementLinkURLKey];
+    if (url)
+        return [self _defaultMenuItemsForLink:hitTestResult];
+
+    return @[ ];
+}
+
+@end

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2014-10-29 04:55:46 UTC (rev 175306)
@@ -269,4 +269,11 @@
 
 - (NSData *)webCryptoMasterKeyForWebView:(WebView *)sender;
 
+enum {
+    WebActionMenuItemTagNoAction = 0,
+    WebActionMenuItemTagOpenLinkInDefaultBrowser,
+    WebActionMenuItemTagPreviewLink,
+    WebActionMenuItemTagAddLinkToSafariReadingList
+};
+
 @end

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm	2014-10-29 04:55:46 UTC (rev 175306)
@@ -199,6 +199,7 @@
 #import <wtf/StdLibExtras.h>
 
 #if !PLATFORM(IOS)
+#import "WebActionMenuController.h"
 #import "WebContextMenuClient.h"
 #import "WebFullScreenController.h"
 #import "WebNSEventExtras.h"
@@ -206,6 +207,7 @@
 #import "WebNSPasteboardExtras.h"
 #import "WebNSPrintOperationExtras.h"
 #import "WebPDFView.h"
+#import <WebCore/NSViewSPI.h>
 #import <WebCore/WebVideoFullscreenController.h>
 #else
 #import "MemoryMeasure.h"
@@ -1073,6 +1075,12 @@
     [self setMaintainsBackForwardList: YES];
 #if !PLATFORM(IOS)
     _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
+
+    if ([self respondsToSelector:@selector(setActionMenu:)]) {
+        RetainPtr<NSMenu> actionMenu = adoptNS([[NSMenu alloc] init]);
+        self.actionMenu = actionMenu.get();
+        _private->actionMenuController = [[WebActionMenuController alloc] initWithWebView:self];
+    }
 #endif
     return self;
 }
@@ -1721,6 +1729,7 @@
     [self setUIDelegate:nil];
 
     [_private->inspector webViewClosed];
+    [_private->actionMenuController webViewClosed];
 #endif
 
 #if !PLATFORM(IOS)
@@ -8538,6 +8547,14 @@
     return NSMakeRect(rect.origin.x, [self bounds].size.height - rect.origin.y - rect.size.height, rect.size.width, rect.size.height);
 }
 
+- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
+{
+    if (menu != self.actionMenu)
+        return;
+
+    [_private->actionMenuController prepareForMenu:menu withEvent:event];
+}
+
 @end
 
 @implementation WebView (WebViewDeviceOrientation)

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h	2014-10-29 04:55:46 UTC (rev 175306)
@@ -49,6 +49,7 @@
 class Page;
 }
 
+@class WebActionMenuController;
 @class WebInspector;
 @class WebNodeHighlight;
 @class WebPluginDatabase;
@@ -145,6 +146,8 @@
     WebInspector *inspector;
     WebNodeHighlight *currentNodeHighlight;
 
+    WebActionMenuController *actionMenuController;
+
     BOOL allowsUndo;
         
     float zoomMultiplier;

Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm (175305 => 175306)


--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm	2014-10-29 04:34:32 UTC (rev 175305)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm	2014-10-29 04:55:46 UTC (rev 175306)
@@ -144,6 +144,7 @@
 #endif
     [inspector release];
     [currentNodeHighlight release];
+    [actionMenuController release];
     [hostWindow release];
     [policyDelegateForwarder release];
     [UIDelegateForwarder release];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to