From eb03436ff65335d085a0b1a445d02923bbf5b80b Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 26 Jan 2022 15:36:37 -0800 Subject: [PATCH] browser(webkit): meta+click on mac (#11660) --- browser_patches/webkit/BUILD_NUMBER | 4 ++-- .../webkit/embedder/Playwright/mac/AppDelegate.m | 10 ++++++++++ .../embedder/Playwright/mac/BrowserWindowController.m | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER index 1be693d8a2..9ea4ce9d3f 100644 --- a/browser_patches/webkit/BUILD_NUMBER +++ b/browser_patches/webkit/BUILD_NUMBER @@ -1,2 +1,2 @@ -1602 -Changed: yurys@chromium.org Tue 25 Jan 2022 06:07:37 PM PST +1603 +Changed: yurys@chromium.org Wed Jan 26 15:11:07 PST 2022 diff --git a/browser_patches/webkit/embedder/Playwright/mac/AppDelegate.m b/browser_patches/webkit/embedder/Playwright/mac/AppDelegate.m index 8f20d37177..f2c59ccbb6 100644 --- a/browser_patches/webkit/embedder/Playwright/mac/AppDelegate.m +++ b/browser_patches/webkit/embedder/Playwright/mac/AppDelegate.m @@ -451,6 +451,16 @@ const NSActivityOptions ActivityOptions = decisionHandler(WKNavigationActionPolicyDownload); return; } + + if (navigationAction.buttonNumber == 1 && + (navigationAction.modifierFlags & (NSEventModifierFlagCommand | NSEventModifierFlagShift)) != 0) { + WKWindowFeatures* windowFeatures = [[[WKWindowFeatures alloc] init] autorelease]; + WKWebView* newView = [self webView:webView createWebViewWithConfiguration:webView.configuration forNavigationAction:navigationAction windowFeatures:windowFeatures]; + [newView loadRequest:navigationAction.request]; + decisionHandler(WKNavigationActionPolicyCancel); + return; + } + if (navigationAction._canHandleRequest) { decisionHandler(WKNavigationActionPolicyAllow); return; diff --git a/browser_patches/webkit/embedder/Playwright/mac/BrowserWindowController.m b/browser_patches/webkit/embedder/Playwright/mac/BrowserWindowController.m index 0b5fef6cea..6996296050 100644 --- a/browser_patches/webkit/embedder/Playwright/mac/BrowserWindowController.m +++ b/browser_patches/webkit/embedder/Playwright/mac/BrowserWindowController.m @@ -740,6 +740,15 @@ static NSSet *dataTypes() return; } + if (navigationAction.buttonNumber == 1 && + (navigationAction.modifierFlags & (NSEventModifierFlagCommand | NSEventModifierFlagShift)) != 0) { + WKWindowFeatures* windowFeatures = [[[WKWindowFeatures alloc] init] autorelease]; + WKWebView* newView = [self webView:webView createWebViewWithConfiguration:webView.configuration forNavigationAction:navigationAction windowFeatures:windowFeatures]; + [newView loadRequest:navigationAction.request]; + decisionHandler(WKNavigationActionPolicyCancel); + return; + } + if (navigationAction._canHandleRequest) { decisionHandler(WKNavigationActionPolicyAllow); return;