Skip to content

Commit 3162c06

Browse files
authored
browser(webkit): outerWidth/Height on Windows (#3154)
1 parent e7cca86 commit 3162c06

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

browser_patches/webkit/BUILD_NUMBER

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
1317
2-
Changed: lushnikov@chromium.org Thu Jul 23 17:44:30 PDT 2020
1+
1318
2+
Changed: yurys@chromium.org Fri Jul 24 20:46:33 GMTST 2020

browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, HWND mainW
8585
uiClient.runJavaScriptPrompt = runJavaScriptPrompt;
8686
uiClient.runBeforeUnloadConfirmPanel = runBeforeUnloadConfirmPanel;
8787
uiClient.handleJavaScriptDialog = handleJavaScriptDialog;
88+
uiClient.getWindowFrame = getWindowFrame;
8889
WKPageSetPageUIClient(page, &uiClient.base);
8990

9091
WKPageStateClientV0 stateClient = { };
@@ -338,6 +339,19 @@ void WebKitBrowserWindow::handleJavaScriptDialog(WKPageRef page, bool accept, WK
338339
}
339340
}
340341

342+
WKRect WebKitBrowserWindow::getWindowFrame(WKPageRef page, const void *clientInfo) {
343+
auto& thisWindow = toWebKitBrowserWindow(clientInfo);
344+
WKRect wkFrame { };
345+
RECT r;
346+
if (::GetWindowRect(thisWindow.m_hMainWnd, &r)) {
347+
wkFrame.origin.x = r.left;
348+
wkFrame.origin.y = r.top;
349+
wkFrame.size.width = r.right - r.left;
350+
wkFrame.size.height = r.bottom - r.top;
351+
}
352+
return wkFrame;
353+
}
354+
341355
WKPageRef WebKitBrowserWindow::createPageCallback(WKPageConfigurationRef configuration)
342356
{
343357
// This comes from the Playwright agent, configuration is a pool+data pair.

browser_patches/webkit/embedder/Playwright/win/WebKitBrowserWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class WebKitBrowserWindow {
7070
static void runJavaScriptPrompt(WKPageRef page, WKStringRef message, WKStringRef defaultValue, WKFrameRef frame, WKSecurityOriginRef securityOrigin, WKPageRunJavaScriptPromptResultListenerRef listener, const void *clientInfo);
7171
static void runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo);
7272
static void handleJavaScriptDialog(WKPageRef page, bool accept, WKStringRef value, const void *clientInfo);
73+
static WKRect getWindowFrame(WKPageRef page, const void *clientInfo);
7374
static void didNotHandleKeyEvent(WKPageRef, WKNativeEventPtr, const void*);
7475
static void decidePolicyForResponse(WKPageRef, WKFrameRef, WKURLResponseRef, WKURLRequestRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
7576

0 commit comments

Comments
 (0)