Title: [187146] trunk/Source
- Revision
- 187146
- Author
- commit-qu...@webkit.org
- Date
- 2015-07-21 18:49:40 -0700 (Tue, 21 Jul 2015)
Log Message
Web Inspector: [Mac] "Open Image In New Window" context menu item does nothing on an image
https://bugs.webkit.org/show_bug.cgi?id=147175
Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-07-21
Reviewed by Timothy Hatcher.
Source/WebKit/mac:
* WebCoreSupport/WebInspectorClient.mm:
(-[WebInspectorWindowController webView:contextMenuItemsForElement:defaultMenuItems:]):
Remove default context menus that won't work in the inspector page.
Source/WebKit2:
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::getContextMenuFromProposedMenu):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
Remove default context menus that won't work in the inspector page.
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (187145 => 187146)
--- trunk/Source/WebKit/mac/ChangeLog 2015-07-22 01:46:00 UTC (rev 187145)
+++ trunk/Source/WebKit/mac/ChangeLog 2015-07-22 01:49:40 UTC (rev 187146)
@@ -1,3 +1,14 @@
+2015-07-21 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: [Mac] "Open Image In New Window" context menu item does nothing on an image
+ https://bugs.webkit.org/show_bug.cgi?id=147175
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (-[WebInspectorWindowController webView:contextMenuItemsForElement:defaultMenuItems:]):
+ Remove default context menus that won't work in the inspector page.
+
2015-07-21 Simon Fraser <simon.fra...@apple.com>
Add a logging channel for Layout, remove the LiveConnect channel
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm (187145 => 187146)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm 2015-07-22 01:46:00 UTC (rev 187145)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm 2015-07-22 01:49:40 UTC (rev 187146)
@@ -40,7 +40,7 @@
#import "WebPolicyDelegate.h"
#import "WebQuotaManager.h"
#import "WebSecurityOriginPrivate.h"
-#import "WebUIDelegate.h"
+#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
#import <algorithm>
#import <bindings/ScriptValue.h>
@@ -737,6 +737,28 @@
databaseQuotaManager.quota = std::max<unsigned long long>(5 * 1024 * 1024, databaseQuotaManager.usage * 1.25);
}
+- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
+{
+ NSMutableArray *menuItems = [[NSMutableArray alloc] init];
+
+ for (NSMenuItem *item in defaultMenuItems) {
+ switch (item.tag) {
+ case WebMenuItemTagOpenLinkInNewWindow:
+ case WebMenuItemTagOpenImageInNewWindow:
+ case WebMenuItemTagOpenFrameInNewWindow:
+ case WebMenuItemTagOpenMediaInNewWindow:
+ case WebMenuItemTagDownloadLinkToDisk:
+ case WebMenuItemTagDownloadImageToDisk:
+ break;
+ default:
+ [menuItems addObject:item];
+ break;
+ }
+ }
+
+ return [menuItems autorelease];
+}
+
// MARK: -
// MARK: Policy delegate
Modified: trunk/Source/WebKit2/ChangeLog (187145 => 187146)
--- trunk/Source/WebKit2/ChangeLog 2015-07-22 01:46:00 UTC (rev 187145)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-22 01:49:40 UTC (rev 187146)
@@ -1,3 +1,15 @@
+2015-07-21 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: [Mac] "Open Image In New Window" context menu item does nothing on an image
+ https://bugs.webkit.org/show_bug.cgi?id=147175
+
+ Reviewed by Timothy Hatcher.
+
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::getContextMenuFromProposedMenu):
+ (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+ Remove default context menus that won't work in the inspector page.
+
2015-07-21 Benjamin Poulain <benja...@webkit.org>
[Content Extensions] Use a jump table when consecutive transitions have different targets
Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (187145 => 187146)
--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2015-07-22 01:46:00 UTC (rev 187145)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm 2015-07-22 01:49:40 UTC (rev 187146)
@@ -29,6 +29,8 @@
#if PLATFORM(MAC) && WK_API_ENABLED
#import "WKAPICast.h"
+#import "WKArray.h"
+#import "WKContextMenuItem.h"
#import "WKInspectorPrivateMac.h"
#import "WKMutableArray.h"
#import "WKOpenPanelParameters.h"
@@ -249,6 +251,30 @@
completionHandler([openPanel runModal]);
}
+static void getContextMenuFromProposedMenu(WKPageRef pageRef, WKArrayRef proposedMenuRef, WKArrayRef* newMenuRef, WKHitTestResultRef, WKTypeRef, const void*)
+{
+ WKMutableArrayRef menuItems = WKMutableArrayCreate();
+
+ size_t count = WKArrayGetSize(proposedMenuRef);
+ for (size_t i = 0; i < count; ++i) {
+ WKContextMenuItemRef contextMenuItem = static_cast<WKContextMenuItemRef>(WKArrayGetItemAtIndex(proposedMenuRef, i));
+ switch (WKContextMenuItemGetTag(contextMenuItem)) {
+ case kWKContextMenuItemTagOpenLinkInNewWindow:
+ case kWKContextMenuItemTagOpenImageInNewWindow:
+ case kWKContextMenuItemTagOpenFrameInNewWindow:
+ case kWKContextMenuItemTagOpenMediaInNewWindow:
+ case kWKContextMenuItemTagDownloadLinkToDisk:
+ case kWKContextMenuItemTagDownloadImageToDisk:
+ break;
+ default:
+ WKArrayAppendItem(menuItems, contextMenuItem);
+ break;
+ }
+ }
+
+ *newMenuRef = menuItems;
+}
+
void WebInspectorProxy::attachmentViewDidChange(NSView *oldView, NSView *newView)
{
[[NSNotificationCenter defaultCenter] removeObserver:m_inspectorProxyObjCAdapter.get() name:NSViewFrameDidChangeNotification object:oldView];
@@ -470,6 +496,18 @@
WKPageSetPageUIClient(toAPI(inspectorPage), &uiClient.base);
+ WKPageContextMenuClientV3 contextMenuClient = {
+ { 3, this },
+ 0, // getContextMenuFromProposedMenu_deprecatedForUseWithV0
+ 0, // customContextMenuItemSelected
+ 0, // contextMenuDismissed
+ getContextMenuFromProposedMenu,
+ 0, // showContextMenu
+ 0, // hideContextMenu
+ };
+
+ WKPageSetPageContextMenuClient(toAPI(inspectorPage), &contextMenuClient.base);
+
return inspectorPage;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes