browser(webkit): flag to disable accelerated compositing on win (#10024)

This commit is contained in:
Yury Semikhatsky 2021-11-03 15:24:34 -07:00 committed by GitHub
parent bce9a8187d
commit bf515205b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 5 deletions

View File

@ -1,2 +1,2 @@
1571
Changed: yurys@chromium.org Wed 03 Nov 2021 08:42:54 AM PDT
1572
Changed: yurys@chromium.org Wed, Nov 3, 2021 10:07:22 PM

View File

@ -197,6 +197,8 @@ CommandLineOptions parseCommandLine()
options.headless = true;
else if (!wcsicmp(argv[i], L"--no-startup-window"))
options.noStartupWindow = true;
else if (!wcsicmp(argv[i], L"--disable-accelerated-compositing"))
options.disableAcceleratedCompositing = true;
else if (!options.requestedURL)
options.requestedURL = argv[i];
}

View File

@ -36,6 +36,7 @@ struct CommandLineOptions {
bool inspectorPipe { };
bool headless { };
bool noStartupWindow { };
bool disableAcceleratedCompositing { };
_bstr_t requestedURL;
_bstr_t userDataDir;
_bstr_t curloptProxy;

View File

@ -28,6 +28,7 @@
#include "MainWindow.h"
#include "PlaywrightLibResource.h"
#include "WebKitBrowserWindow.h"
#include <WebKit/WKPreferencesRefPrivate.h>
#include <sstream>
namespace WebCore {
@ -49,10 +50,12 @@ size_t MainWindow::s_numInstances;
bool MainWindow::s_headless = false;
bool MainWindow::s_controlledRemotely = false;
bool MainWindow::s_disableAcceleratedCompositing = false;
void MainWindow::configure(bool headless, bool controlledRemotely) {
void MainWindow::configure(bool headless, bool controlledRemotely, bool disableAcceleratedCompositing) {
s_headless = headless;
s_controlledRemotely = controlledRemotely;
s_disableAcceleratedCompositing = disableAcceleratedCompositing;
}
static std::wstring loadString(int id)
@ -180,6 +183,8 @@ bool MainWindow::init(HINSTANCE hInstance, WKPageConfigurationRef conf)
WKPageConfigurationSetPreferences(conf, prefs.get());
WKPreferencesSetMediaCapabilitiesEnabled(prefs.get(), false);
WKPreferencesSetDeveloperExtrasEnabled(prefs.get(), true);
if (s_disableAcceleratedCompositing)
WKPreferencesSetAcceleratedCompositingEnabled(prefs.get(), false);
m_configuration = conf;

View File

@ -35,7 +35,7 @@
class MainWindow : public BrowserWindowClient {
public:
static void configure(bool headless, bool controlledRemotely);
static void configure(bool headless, bool controlledRemotely, bool disableAcceleratedCompositing);
MainWindow();
@ -57,6 +57,7 @@ private:
static size_t s_numInstances;
static bool s_headless;
static bool s_controlledRemotely;
static bool s_disableAcceleratedCompositing;
bool toggleMenuItem(UINT menuID);
void onURLBarEnter();

View File

@ -101,7 +101,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
if (SetProcessDpiAwarenessContextPtr())
SetProcessDpiAwarenessContextPtr()(DPI_AWARENESS_CONTEXT_UNAWARE);
MainWindow::configure(g_options.headless, g_options.inspectorPipe);
MainWindow::configure(g_options.headless, g_options.inspectorPipe, g_options.disableAcceleratedCompositing);
if (!g_options.noStartupWindow) {
auto configuration = adoptWK(WKWebsiteDataStoreConfigurationCreate());