browser(webkit): ctrl+click on windows (#11667)
This commit is contained in:
Родитель
b1fbc4fdbe
Коммит
84a5400d0d
|
@ -1,2 +1,2 @@
|
|||
1603
|
||||
Changed: yurys@chromium.org Wed Jan 26 15:11:07 PST 2022
|
||||
1604
|
||||
Changed: yurys@chromium.org Thu, Jan 27, 2022 1:59:07 AM
|
||||
|
|
|
@ -100,6 +100,7 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, HWND mainW
|
|||
policyClient.base.version = 1;
|
||||
policyClient.base.clientInfo = this;
|
||||
policyClient.decidePolicyForResponse_deprecatedForUseWithV0 = decidePolicyForResponse;
|
||||
policyClient.decidePolicyForNavigationAction = decidePolicyForNavigationAction;
|
||||
WKPageSetPagePolicyClient(page, &policyClient.base);
|
||||
resetZoom();
|
||||
}
|
||||
|
@ -384,6 +385,20 @@ void WebKitBrowserWindow::didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr event
|
|||
PostMessage(thisWindow.m_hMainWnd, event->message, event->wParam, event->lParam);
|
||||
}
|
||||
|
||||
void WebKitBrowserWindow::decidePolicyForNavigationAction(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKFrameRef originatingFrame, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
|
||||
{
|
||||
WebKitBrowserWindow* browserWindow = reinterpret_cast<WebKitBrowserWindow*>(const_cast<void*>(clientInfo));
|
||||
if (navigationType == kWKFrameNavigationTypeLinkClicked &&
|
||||
mouseButton == kWKEventMouseButtonLeftButton &&
|
||||
(modifiers & (kWKEventModifiersShiftKey | kWKEventModifiersControlKey)) != 0) {
|
||||
WKRetainPtr<WKPageRef> newPage = createViewCallback(WKPageCopyPageConfiguration(page), false);
|
||||
WKPageLoadURLRequest(newPage.get(), request);
|
||||
WKFramePolicyListenerIgnore(listener);
|
||||
return;
|
||||
}
|
||||
WKFramePolicyListenerUse(listener);
|
||||
}
|
||||
|
||||
void WebKitBrowserWindow::decidePolicyForResponse(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
|
||||
{
|
||||
if (WKURLResponseIsAttachment(response))
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
static void handleJavaScriptDialog(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo);
|
||||
static WKRect getWindowFrame(WKPageRef page, const void *clientInfo);
|
||||
static void didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr, const void*);
|
||||
static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void* clientInfo);
|
||||
static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
|
||||
|
||||
BrowserWindowClient& m_client;
|
||||
|
|
Загрузка…
Ссылка в новой задаче