Bug 255937

Summary: [WinCairo]REGRESSION(263118@main): Small viewport does end up in broken screenshots via Page.snapshotRect
Product: WebKit Reporter: Max Schmitt <max>
Component: PlatformAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: Hironori.Fujii
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Windows 10   

Description Max Schmitt 2023-04-25 11:11:06 PDT
If a small viewport like 50x50 is used, on Windows it does not get rendered at all on the window (since its outside of the window). Since still a WebView::onSizeEvent event gets emitted with 50x0, we want to ignore it and not use it as an actual window size in the drawing area.

Thats how it was done before the patch.

Downstream bug: https://github.com/microsoft/playwright/issues/22616
Comment 1 Max Schmitt 2023-04-25 11:14:43 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13158
Comment 2 Fujii Hironori 2023-04-25 13:43:34 PDT
Windows WebKit Playwright is still using non-GPU process mode.
We have to modify MiniBrowser to use non-GPU process mode in MiniBrowser.

diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
index fac65d82f8ab..ff977c47f1c7 100644
--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
@@ -145,6 +145,10 @@ Ref<BrowserWindow> WebKitBrowserWindow::create(BrowserWindowClient& client, HWND
     WKPreferencesSetMediaCapabilitiesEnabled(preferences.get(), false);
     WKPreferencesSetDeveloperExtrasEnabled(preferences.get(), true);
 
+#if 1 // Don't land this
+    WKPreferencesSetBoolValueForKeyForTesting(preferences.get(), false, createWKString("UseGPUProcessForWebGLEnabled").get());
+#endif
+
     auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(createWKString("WinMiniBrowser").get()));
     WKPageGroupSetPreferences(pageGroup.get(), preferences.get());
 

However, I can't see any problems with small window size.
Comment 3 Max Schmitt 2023-05-12 02:48:34 PDT
We have now a minimal viewport of 250x250 which works for us.