Title: [225234] trunk/Source/WebKit
Revision
225234
Author
[email protected]
Date
2017-11-28 13:02:27 -0800 (Tue, 28 Nov 2017)

Log Message

REGRESSION: Web Inspector: context menu actions "Download Image" and "Open Image in New Window" don't work
https://bugs.webkit.org/show_bug.cgi?id=178808
<rdar://problem/35176608>

Patch by Joseph Pecoraro <[email protected]> on 2017-11-28
Reviewed by Brian Burg.

* UIProcess/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController _webView:contextMenu:forElement:]):
Continue to hide the image context menu actions like we used to.
Investigating making these context menus work can be done as a
follow-up task.

* UIProcess/mac/WKWebInspectorWKWebView.mm:
(-[WKWebInspectorWKWebView initWithFrame:configuration:]):
Use nullptr instead of 0.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (225233 => 225234)


--- trunk/Source/WebKit/ChangeLog	2017-11-28 20:54:50 UTC (rev 225233)
+++ trunk/Source/WebKit/ChangeLog	2017-11-28 21:02:27 UTC (rev 225234)
@@ -1,3 +1,21 @@
+2017-11-28  Joseph Pecoraro  <[email protected]>
+
+        REGRESSION: Web Inspector: context menu actions "Download Image" and "Open Image in New Window" don't work
+        https://bugs.webkit.org/show_bug.cgi?id=178808
+        <rdar://problem/35176608>
+
+        Reviewed by Brian Burg.
+
+        * UIProcess/mac/WKInspectorViewController.mm:
+        (-[WKInspectorViewController _webView:contextMenu:forElement:]):
+        Continue to hide the image context menu actions like we used to.
+        Investigating making these context menus work can be done as a
+        follow-up task.
+
+        * UIProcess/mac/WKWebInspectorWKWebView.mm:
+        (-[WKWebInspectorWKWebView initWithFrame:configuration:]):
+        Use nullptr instead of 0.
+
 2017-11-14  Carlos Garcia Campos  <[email protected]>
 
         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h

Modified: trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm (225233 => 225234)


--- trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm	2017-11-28 20:54:50 UTC (rev 225233)
+++ trunk/Source/WebKit/UIProcess/mac/WKInspectorViewController.mm	2017-11-28 21:02:27 UTC (rev 225234)
@@ -189,6 +189,27 @@
     decisionHandler(std::max<unsigned long long>(expectedUsage, currentUsage * 1.25));
 }
 
+- (NSMenu *)_webView:(WKWebView *)webView contextMenu:(NSMenu *)menu forElement:(_WKContextMenuElementInfo *)element
+{
+    for (NSInteger i = menu.numberOfItems - 1; i >= 0; --i) {
+        NSMenuItem *item = [menu itemAtIndex:i];
+        switch (item.tag) {
+        case kWKContextMenuItemTagOpenLinkInNewWindow:
+        case kWKContextMenuItemTagOpenImageInNewWindow:
+        case kWKContextMenuItemTagOpenFrameInNewWindow:
+        case kWKContextMenuItemTagOpenMediaInNewWindow:
+        case kWKContextMenuItemTagCopyImageUrlToClipboard:
+        case kWKContextMenuItemTagCopyImageToClipboard:
+        case kWKContextMenuItemTagDownloadLinkToDisk:
+        case kWKContextMenuItemTagDownloadImageToDisk:
+            [menu removeItemAtIndex:i];
+            break;
+        }
+    }
+
+    return menu;
+}
+
 // MARK: WKNavigationDelegate methods
 
 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView

Modified: trunk/Source/WebKit/UIProcess/mac/WKWebInspectorWKWebView.mm (225233 => 225234)


--- trunk/Source/WebKit/UIProcess/mac/WKWebInspectorWKWebView.mm	2017-11-28 20:54:50 UTC (rev 225233)
+++ trunk/Source/WebKit/UIProcess/mac/WKWebInspectorWKWebView.mm	2017-11-28 21:02:27 UTC (rev 225234)
@@ -115,52 +115,52 @@
 
     WKPageUIClientV2 uiClient = {
         { 2, self },
-        0, // createNewPage_deprecatedForUseWithV0
-        0, // showPage
-        0, // closePage
-        0, // takeFocus
-        0, // focus
-        0, // unfocus
-        0, // runJavaScriptAlert
-        0, // runJavaScriptConfirm
-        0, // runJavaScriptPrompt
-        0, // setStatusText
-        0, // mouseDidMoveOverElement_deprecatedForUseWithV0
-        0, // missingPluginButtonClicked_deprecatedForUseWithV0
-        0, // didNotHandleKeyEvent
-        0, // didNotHandleWheelEvent
-        0, // areToolbarsVisible
-        0, // setToolbarsVisible
-        0, // isMenuBarVisible
-        0, // setMenuBarVisible
-        0, // isStatusBarVisible
-        0, // setStatusBarVisible
-        0, // isResizable
-        0, // setResizable
+        nullptr, // createNewPage_deprecatedForUseWithV0
+        nullptr, // showPage
+        nullptr, // closePage
+        nullptr, // takeFocus
+        nullptr, // focus
+        nullptr, // unfocus
+        nullptr, // runJavaScriptAlert
+        nullptr, // runJavaScriptConfirm
+        nullptr, // runJavaScriptPrompt
+        nullptr, // setStatusText
+        nullptr, // mouseDidMoveOverElement_deprecatedForUseWithV0
+        nullptr, // missingPluginButtonClicked_deprecatedForUseWithV0
+        nullptr, // didNotHandleKeyEvent
+        nullptr, // didNotHandleWheelEvent
+        nullptr, // areToolbarsVisible
+        nullptr, // setToolbarsVisible
+        nullptr, // isMenuBarVisible
+        nullptr, // setMenuBarVisible
+        nullptr, // isStatusBarVisible
+        nullptr, // setStatusBarVisible
+        nullptr, // isResizable
+        nullptr, // setResizable
         getWindowFrame,
         setWindowFrame,
-        0, // runBeforeUnloadConfirmPanel
-        0, // didDraw
-        0, // pageDidScroll
+        nullptr, // runBeforeUnloadConfirmPanel
+        nullptr, // didDraw
+        nullptr, // pageDidScroll
         exceededDatabaseQuota,
         runOpenPanel,
-        0, // decidePolicyForGeolocationPermissionRequest
-        0, // headerHeight
-        0, // footerHeight
-        0, // drawHeader
-        0, // drawFooter
-        0, // printFrame
-        0, // runModal
-        0, // unused
-        0, // saveDataToFileInDownloadsFolder
-        0, // shouldInterruptJavaScript
-        0, // createPage
-        0, // mouseDidMoveOverElement
-        0, // decidePolicyForNotificationPermissionRequest
-        0, // unavailablePluginButtonClicked_deprecatedForUseWithV1
-        0, // showColorPicker
-        0, // hideColorPicker
-        0, // unavailablePluginButtonClicked
+        nullptr, // decidePolicyForGeolocationPermissionRequest
+        nullptr, // headerHeight
+        nullptr, // footerHeight
+        nullptr, // drawHeader
+        nullptr, // drawFooter
+        nullptr, // printFrame
+        nullptr, // runModal
+        nullptr, // unused
+        nullptr, // saveDataToFileInDownloadsFolder
+        nullptr, // shouldInterruptJavaScript
+        nullptr, // createPage
+        nullptr, // mouseDidMoveOverElement
+        nullptr, // decidePolicyForNotificationPermissionRequest
+        nullptr, // unavailablePluginButtonClicked_deprecatedForUseWithV1
+        nullptr, // showColorPicker
+        nullptr, // hideColorPicker
+        nullptr, // unavailablePluginButtonClicked
     };
 
     WebPageProxy* inspectorPage = self->_page.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to