Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(webkit): meta+click on mac (#11660)

Yury Semikhatskyeb03436ff653
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: [email protected] Tue 25 Jan 2022 06:07:37 PM PST
+1603
+Changed: [email protected] 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;