chrome: Add support for Alloy style browsers and windows (see #3681)

Split the Alloy runtime into bootstrap and style components. Support
creation of Alloy style browsers and windows with the Chrome runtime.
Chrome runtime (`--enable-chrome-runtime`) + Alloy style
(`--use-alloy-style`) supports Views (`--use-views`), native parent
(`--use-native`) and windowless rendering
(`--off-screen-rendering-enabled`).

Print preview is supported in all cases except with windowless rendering
on all platforms and native parent on MacOS. It is disabled by default
with Alloy style for legacy compatibility. Where supported it can be
enabled or disabled globally using `--[enable|disable]-print-preview` or
configured on a per-RequestContext basis using the
`printing.print_preview_disabled` preference. It also behaves as
expected when triggered via the PDF viewer print button.

Chrome runtime + Alloy style behavior differs from Alloy runtime in the
following significant ways:

- Supports Chrome error pages by default.
- DevTools popups are Chrome style only (cannot be windowless).
- The Alloy extension API will not supported.

Chrome runtime + Alloy style passes all expected Alloy ceftests except
the following:

- `DisplayTest.AutoResize` (Alloy extension API not supported)
- `DownloadTest.*` (Download API not yet supported)
- `ExtensionTest.*` (Alloy extension API not supported)

This change also adds Chrome runtime support for
CefContextMenuHandler::RunContextMenu (see #3293).

This change also explicitly blocks (and doesn't retry) FrameAttached
requests from PDF viewer and print preview excluded frames (see #3664).

Known issues specific to Chrome runtime + Alloy style:
- DevTools popup with windowless rendering doesn't load successfully.
  Use windowed rendering or remote debugging as a workaround.
- Chrome style Window with Alloy style BrowserView (`--use-alloy-style
  --use-chrome-style-window`) does not show Chrome theme changes.

To test:
- Run `ceftests --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window] [--use-views|--use-native]
       --gtest_filter=...`
- Run `cefclient --enable-chrome-runtime --use-alloy-style
       [--use-chrome-style-window]
       [--use-views|--use-native|--off-screen-rendering-enabled]`
- Run `cefsimple --enable-chrome-runtime --use-alloy-style [--use-views]`
This commit is contained in:
Marshall Greenblatt
2024-04-17 12:01:26 -04:00
parent 62c93f01f4
commit dca0435d2f
216 changed files with 3388 additions and 1565 deletions

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=da0fdd0a724301aa3ca12055bce970b9d3d0f708$
// $hash=8db751f9d33c0279c801c0820d8a15d4c14fede6$
//
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
@@ -1314,6 +1314,24 @@ bool CefBrowserHostCToCpp::IsRenderProcessUnresponsive() {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
cef_runtime_style_t CefBrowserHostCToCpp::GetRuntimeStyle() {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_runtime_style)) {
return CEF_RUNTIME_STYLE_DEFAULT;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_runtime_style_t _retval = _struct->get_runtime_style(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefBrowserHostCToCpp::CefBrowserHostCToCpp() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=ec03d4b0c8e59ba8f8eb3060e374b4d76e22669b$
// $hash=4b9914613aed142228d0cfe181a6ac65e9b6e494$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
@@ -140,6 +140,7 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
void ExecuteChromeCommand(int command_id,
cef_window_open_disposition_t disposition) override;
bool IsRenderProcessUnresponsive() override;
cef_runtime_style_t GetRuntimeStyle() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=fce37150f543768b0e9df8c5b8163d0ac4829a52$
// $hash=88f55766622ea99679e1b4c2748103d397e32117$
//
#include "libcef_dll/ctocpp/views/browser_view_ctocpp.h"
@@ -128,6 +128,24 @@ void CefBrowserViewCToCpp::SetPreferAccelerators(bool prefer_accelerators) {
_struct->set_prefer_accelerators(_struct, prefer_accelerators);
}
NO_SANITIZE("cfi-icall")
cef_runtime_style_t CefBrowserViewCToCpp::GetRuntimeStyle() {
shutdown_checker::AssertNotShutdown();
cef_browser_view_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_runtime_style)) {
return CEF_RUNTIME_STYLE_DEFAULT;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_runtime_style_t _retval = _struct->get_runtime_style(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefBrowserView> CefBrowserViewCToCpp::AsBrowserView() {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d407851a21f82fc67289bd6314f31f46e07870df$
// $hash=a61b633e9b8e4156fd4cdcb778ad54e38106dc0d$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_CTOCPP_H_
@@ -37,6 +37,7 @@ class CefBrowserViewCToCpp : public CefCToCppRefCounted<CefBrowserViewCToCpp,
CefRefPtr<CefBrowser> GetBrowser() override;
CefRefPtr<CefView> GetChromeToolbar() override;
void SetPreferAccelerators(bool prefer_accelerators) override;
cef_runtime_style_t GetRuntimeStyle() override;
// CefView methods.
CefRefPtr<CefBrowserView> AsBrowserView() override;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bf57f469c4dc266377346d8874406c437b682112$
// $hash=c6c0fc1c3202ac8932071dcd2753b1b71b65696c$
//
#include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
@@ -228,6 +228,24 @@ bool CefBrowserViewDelegateCToCpp::OnGestureCommand(
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
cef_runtime_style_t CefBrowserViewDelegateCToCpp::GetBrowserRuntimeStyle() {
shutdown_checker::AssertNotShutdown();
cef_browser_view_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_browser_runtime_style)) {
return CEF_RUNTIME_STYLE_DEFAULT;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_runtime_style_t _retval = _struct->get_browser_runtime_style(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefSize CefBrowserViewDelegateCToCpp::GetPreferredSize(
CefRefPtr<CefView> view) {

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b7d2905473b08d50a876b01f9e6a275316166c72$
// $hash=2c3b8a886e7955b9eb9d36f22cdf222897c18b16$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_BROWSER_VIEW_DELEGATE_CTOCPP_H_
@@ -57,6 +57,7 @@ class CefBrowserViewDelegateCToCpp
CefRefPtr<CefBrowserView> browser_view) override;
bool OnGestureCommand(CefRefPtr<CefBrowserView> browser_view,
cef_gesture_command_t gesture_command) override;
cef_runtime_style_t GetBrowserRuntimeStyle() override;
// CefViewDelegate methods.
CefSize GetPreferredSize(CefRefPtr<CefView> view) override;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=8b955eda81961599ffef6767305992dbbcd5b12c$
// $hash=6ebaa8a85615b3a4ea46cf32893e4297667f81a4$
//
#include "libcef_dll/ctocpp/views/window_ctocpp.h"
@@ -738,6 +738,24 @@ NO_SANITIZE("cfi-icall") void CefWindowCToCpp::ThemeChanged() {
_struct->theme_changed(_struct);
}
NO_SANITIZE("cfi-icall")
cef_runtime_style_t CefWindowCToCpp::GetRuntimeStyle() {
shutdown_checker::AssertNotShutdown();
cef_window_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_runtime_style)) {
return CEF_RUNTIME_STYLE_DEFAULT;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_runtime_style_t _retval = _struct->get_runtime_style(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") CefRefPtr<CefWindow> CefWindowCToCpp::AsWindow() {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3998ef7a4585ef19268482df51611d0283daf275$
// $hash=d0c83991173ca5acb77c4bb8525cca3b645a2b19$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_CTOCPP_H_
@@ -90,6 +90,7 @@ class CefWindowCToCpp
void RemoveAllAccelerators() override;
void SetThemeColor(int color_id, cef_color_t color) override;
void ThemeChanged() override;
cef_runtime_style_t GetRuntimeStyle() override;
// CefPanel methods.
CefRefPtr<CefWindow> AsWindow() override;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=e7548cf2202aa3827f45c56a706f735606db1f83$
// $hash=da609d625660ca617e1a01d5dc359932142e15a3$
//
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
@@ -560,6 +560,24 @@ void CefWindowDelegateCToCpp::OnThemeColorsChanged(CefRefPtr<CefWindow> window,
chrome_theme);
}
NO_SANITIZE("cfi-icall")
cef_runtime_style_t CefWindowDelegateCToCpp::GetWindowRuntimeStyle() {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_window_runtime_style)) {
return CEF_RUNTIME_STYLE_DEFAULT;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_runtime_style_t _retval = _struct->get_window_runtime_style(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=c829c66e21b16f72c4af8421de518eaa89b5e8eb$
// $hash=50ace2b6a45a23d4ff5d9a91ab7c37a893f7e0b4$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@@ -66,6 +66,7 @@ class CefWindowDelegateCToCpp
const CefKeyEvent& event) override;
void OnThemeColorsChanged(CefRefPtr<CefWindow> window,
bool chrome_theme) override;
cef_runtime_style_t GetWindowRuntimeStyle() override;
// CefPanelDelegate methods.