178 Commits
Author SHA1 Message Date
Marshall Greenblatt 38b31337cc osr: win: cefclient: Update D3D11 structure to match Metal/EGL
- Support OnPaint uploads and copy shared textures into owned storage
  before OnAcceleratedPaint returns.
- Redraw the last frame on resize/expose.
- Remove the legacy OpenGL renderer and Windows GL handler.
- Preserve cached images on allocation failure and validate bounds.
- Add OsrRendererD3D11Test unit tests, ported from the Metal/EGL tests.

Tested on Windows 11 x64:
- cefclient resize and select popups work in all eight combinations
  of software/shared textures, internal/external begin frames, and
  single/multi-threaded message loops.
- ceftests: 37 renderer tests pass on hardware/WARP; one allocation
  failure test skips after the driver accepts its oversized descriptor
2026-10-10 10:59:26 -04:00
Marshall Greenblatt c7e1a9e5c6 osr: linux: cefclient: Add OnAcceleratedPaint support (fixes #3687)
- Add OsrRendererGl, a shared OpenGL 3.3 renderer with DMA-BUF import,
  and load EGL/GL at runtime with no new build dependencies.
- Render via GtkGLArea on Wayland and an EGL window surface on X11.
- Redraw the last frame on resize/expose, matching the Metal renderer.
- Exit at startup if OSR is enabled and EGL is unavailable.
- Add OsrRendererGlTest unit tests, ported from the Metal tests.

Tested on a Linux VM (VMware SVGA3D, Mesa 23.2, GNOME Wayland/Xwayland):
- cefclient OSR software and shared-texture (DMA-BUF) rendering on
  Wayland (GtkGLArea) and X11 (EGL window surface), including resize,
  select popups, cursors, --multi-threaded-message-loop and
  --transparent-painting-enabled. Shared texture runs use
  --ignore-gpu-blocklist (VMware is blocklisted).
- ceftests: new OsrRendererGlTest (12 tests, using GBM DMA-BUFs) and
  all existing OSRTest tests pass.
- Missing libEGL: cefclient exits at startup with an error and
  OsrRendererGlTest skips.
2026-10-10 10:59:26 -04:00
Marshall Greenblatt f922057255 linux: cefclient: Fix GTK windows with Wayland (see #3687)
- Fail at startup when --use-native is used with Wayland
  (unsupported, see #2804).
- Remove X11 runtime dependencies from the OSR path.
- Match the GDK backend to the Ozone platform.
- Keep GDK OpenGL enabled with OSR by presetting GDK_GL (see
  https://crrev.com/7c29ce9003d87).
- Share IsRunningOnWayland() between cefclient and ceftests and
  match Chromium detection logic.
2026-10-09 15:46:19 -04:00
Marshall Greenblatt 49815fbdaa osr: mac: cefclient: Fix accessibility object lifetime (fixes #3595)
Native accessibility objects now have explicit ownership, detach
safely before node deletion, and are released during view teardown.
2026-09-11 17:19:57 -04:00
Marshall Greenblatt 9270759d79 osr: mac: cefclient: Add external-begin-frame support (fixes #4033) 2026-09-11 16:34:02 -04:00
Marshall Greenblatt 8786a5a8a3 osr: mac: cefclient: Use Metal for rendering (fixes #3626) 2026-09-11 15:41:16 -04:00
Marshall Greenblatt 13ac447cca Close owned widgets before Chrome browser teardown (see #4006)
Close widgets owned by ChromeBrowserWidget from
OnNativeWidgetDestroying while the native ownership graph is still
available. This prevents popup widgets from outliving Browser state during
native-window-driven shutdown.

Add Chrome-style ceftests for JavaScript, password-save, and synthetic owned
widgets. Confirm that each widget exists before closing the main window and
verify deterministic destruction ordering for the synthetic case. Reset the
password dismissal statistics before loading the password form so repeated
test runs continue to exercise the save-password widget.
2026-08-19 17:38:32 -04:00
Marshall Greenblatt be20927a8d installer: Add bootstrap installer for Windows (see #4093)
Add a shared CEF installer that downloads, verifies, and manages CEF
binary distributions on Windows. The installer is embedded in
application bootstrap binaries and resolves the correct CEF version
from a CDN manifest based on each application's version and ABI
compatibility requirements.

Key components:
- CDN manifest parsing and version resolution
- WinHTTP-based download with SHA-1/SHA-256 integrity verification
- Authenticode catalog (.cat) signature verification
- Parallel XZ decompression for fast archive extraction
- Per-version metadata (cef_version.json) with full version tracking
- Shared installation database for multi-app version management
- Version pruning to reclaim disk space from unused versions
- Revocation list support (compiled-in baseline + CDN delta)
- Progress UI with WM_COPYDATA-based cancellation
- Bundled CEF fallback for offline/CDN-failure scenarios
2026-07-27 14:04:48 -04:00
Marshall Greenblatt 39758987b5 chrome: Fix dangling pointers during child window teardown (fixes #4147)
Fixes two teardown-ordering hazards for Chrome style browsers created with
a native parent window (CefWindowInfo::SetAsChild):

- ChromeBrowserHostImpl::DestroyBrowser() may destroy the platform delegate
  before Widget teardown destroys the ChildWindowDelegate, leaving its
  raw_ptr dangling (SIGTRAP with PartitionAllocDanglingPtr). The pointer
  was only cleared in OnWindowDestroyed on Windows, and only if that ran
  first. Store a base::WeakPtr from the existing
  CefBrowserPlatformDelegateNativeAura factory instead, which
  auto-invalidates on delegate destruction on all Aura platforms.

- In the reverse order on Windows, the client may destroy the parent window
  (and thereby the browser's Widget) while the browser is still alive,
  leaving the Widget pointer cached by set_widget() dangling. SetFocus,
  NotifyMoveOrResizeStarted and root window bounds queries could then
  dereference the deleted Widget. Reuse the existing WidgetDeleted
  mechanism (already wired up for the non-Views-hosted code path in
  CreateHostWindow) by executing the delete callback from
  ChildWindowDelegate::OnWindowDestroyed. The callback is bound with a
  WeakPtr, so it no-ops safely when the delegate is destroyed first.

Adds ceftests coverage for both teardown orders (Windows and Linux X11).
Dangling pointer regressions are detected when running with
--enable-features=PartitionAllocBackupRefPtr,PartitionAllocDanglingPtr or
in an ASAN build. Chrome style is not supported with a native parent on
MacOS (see issue #3294).
2026-07-06 17:44:01 -04:00
Marshall Greenblatt b6e302c3aa Add per-browser ax_viewport_collapse setting
Adds role-aware collapsing of off-screen nodes to CDP accessibility tree
serialization (Accessibility.getFullAXTree). When enabled, off-screen
landmarks and headings are serialized as summaries (role + name only)
and other off-screen nodes are pruned. Position:fixed/sticky descendants
of off-screen parents are still discovered and fully serialized.

Reduces snapshot size for AI agents using Playwright ariaSnapshot().
Platform screen readers are unaffected — they use a separate code path.
CDP nodesUpdated events are suppressed when active.

The setting is a per-browser CefBrowserSettings field threaded through
WebPreferences, with a runtime override via SetAxViewportCollapse().
Both APIs are guarded with CEF_API_ADDED(CEF_EXPERIMENTAL).
2026-03-27 19:05:51 -04:00
Nik Pavlov cb9bab3e3f Add CefComponentUpdater API (fixes #4087)
Exposes component update functionality in CEF, allowing clients to
trigger on-demand updates for registered components.
2026-02-17 13:05:03 -05:00
Marshall Greenblatt f7dfdd4661 Update base headers to C++20 and sync with Chromium (see #3611)
Build configuration:
- Update to C++20 standard across all platforms
- Minimum supported compiler versions for C++20 are:
    - Visual Studio 2019 16.9.3 [unchanged]
    - GCC 10 (Ubuntu 20)
    - Clang 16 (Xcode 16.0)

Base headers synchronized with Chromium:
- Foundation: cef_immediate_crash.h, cef_always_false.h
- Compiler utilities: cef_compiler_specific.h
- Threading primitives: comments/minor fixes only
- Memory management: cef_scoped_refptr.h, cef_ref_counted.h
- WeakPtr: cef_weak_ptr.h
- Callback/Bind system: atomic update of all callback headers

New files:
- cef_is_complete.h, cef_is_instantiation.h, cef_to_address.h
- cef_always_false.h, cef_callback_tags.h

Removed unused standalone headers:
- cef_tuple.h, cef_auto_reset.h, cef_callback_list.h
- cef_cancelable_callback.h, cef_scoped_typeref_mac.h
- cef_scoped_block_mac.h, cef_scoped_policy.h

Unit tests (177 tests + 1 Windows-only):
- Ported base header tests from Chromium to ceftests/base/
- Added gmock support with fused sources
- Added test_bind.h for BindLambdaForTesting()

Documentation:
- Added CLAUDE_BASE_SYNC_INSTRUCTIONS.md for future syncs
2026-01-02 18:07:27 -05:00
Nik Pavlov b9d5a7f881 Add configuration to bypass user activation for Document PiP 2025-12-10 20:49:42 +00:00
Marshall Greenblatt 6813b9a6b7 tests: Add coverage for multiple BrowserViews 2025-12-05 21:51:14 -05:00
Tom Crowley 2f85317f07 Fix CefBrowserSettings not being applied in some cases (fixes #4039) 2025-12-03 12:49:26 -05:00
Marshall Greenblatt 3fed099d09 tests: Add coverage for CefFindHandler 2025-12-01 18:08:48 -05:00
Marshall Greenblatt 2305ffe1d6 tests: Add cefsimple_capi example project
This is a more-or-less direct translation of the cefsimple (C++)
project to use C API based on the updated UsingTheCAPI.md docs.
Translation was performed using Claude Code.
2025-11-13 19:59:23 +00:00
Tom Crowley 2c411892e2 ceftests: Add tests for PrintToPdf 2025-05-29 16:55:50 +00:00
Marshall Greenblatt 6606e241a1 cefclient: win: Add code signing verification (see #3935)
Move code signing verification code to libcef_dll_wrapper
and add example checks in cefclient.

Load libcef.dll with code signing checks.

Add a CefScopedLibraryLoader variant for Windows.
2025-05-29 12:20:30 -04:00
Marshall Greenblatt 77701dda21 Add cef::logging::ScopedEarlySupport (see #3935)
Supports use of logging macros prior to loading libcef.
2025-05-29 12:19:51 -04:00
Marshall Greenblatt cfaa10a746 mac: Convert cef_sandbox to a shared library (see #3928)
Replace statically linked cef_sandbox.a with dynamically loaded
libcef_sandbox.dylib. See the SandboxSetup Wiki page for details.
2025-05-19 11:50:33 -04:00
Marshall Greenblatt faa85bf980 Support JavaScript window.moveTo/By() and resizeTo/By() (fixes #698)
Adds new CefDisplayHandler::OnContentsBoundsChange and
CefDisplayHandler::GetRootWindowScreenRect callbacks.

cefclient: Implement the above callbacks and call
CefBrowserHost::NotifyScreenInfoChanged when the root window
bounds change.

cefclient: osr: Use real screen bounds by default. Pass
`--fake-screen-bounds` for the old default behavior.

Load https://tests/window in cefclient for additional
implementation details and usage examples.
2025-05-05 11:53:33 -04:00
Marshall Greenblatt 549e8fe05c Add visualization for Chrome configuration changes (fixes #3892)
- Add new API to retrieve/observe configuration values.
- cefclient: Add https://tests/config to inspect configuration
  values in real time.
2025-03-10 15:50:46 +00:00
Marshall Greenblatt dd81904a2f Add initial support for API versioning (see #3836)
- Generated files are now created when running cef_create_projects or
  the new version_manager.py tool. These files are still created in the
  cef/ source tree (same location as before) but Git ignores them due to
  the generated .gitignore file.
- API hashes are committed to Git as a new cef_api_versions.json file.
  This file is used for both code generation and CEF version calculation
  (replacing the previous usage of cef_api_hash.h for this purpose).
  It will be updated by the CEF admin before merging breaking API
  changes upstream.
- As an added benefit to the above, contributor PRs will no longer
  contain generated code that is susceptible to frequent merge conflicts.
- From a code generation perspective, the main difference is that we now
  use versioned structs (e.g. cef_browser_0_t instead of cef_browser_t)
  on the libcef (dll/framework) side. Most of the make_*.py tool changes
  are related to supporting this.
- From the client perspective, you can now define CEF_API_VERSION in the
  project configuration (or get CEF_EXPERIMENTAL by default). This
  define will change the API exposed in CEF’s include/ and include/capi
  header files. All client-side targets including libcef_dll_wrapper
  will need be recompiled when changing this define.
- Examples of the new API-related define usage are provided in
  cef_api_version_test.h, api_version_test_impl.cc and
  api_version_unittest.cc.

To test:
- Run `ceftests --gtest_filter=ApiVersionTest.*`
- Add `cef_api_version=13300` to GN_DEFINES. Re-run configure, build and
  ceftests steps.
- Repeat with 13301, 13302, 13303 (all supported test versions).
2025-01-08 17:19:43 -05:00
reito 189b247282 osr: Add more info in accelerated callback (fixes #3730) 2024-12-04 10:44:33 -05:00
Marshall Greenblatt 1bc1ca15d5 cefclient: views: Add overlay BrowserView demo (see #3790)
Adds new `--show-overlay-browser` command-line flag that creates an
overlay containing an Alloy-style BrowserView.  The main BrowserView
may be Chrome- (default) or Alloy-style (add `--use-alloy-style`).
This overlay will only be added to standalone (non-popup) windows.

Popups triggered via the overlay will receive standard Alloy-style
handling in cefclient (e.g. Views-hosted window). Add
`--use-default-popup` for default popup handling.
2024-10-15 14:30:26 -04:00
Marshall Greenblatt 166eec85e0 cefclient: Fix invalid cast to ClientHandlerStd (see #3499) 2024-08-05 18:48:30 -04:00
Marshall Greenblatt a6c00b2ff6 bazel: Add initial config for binary distribution (see #3757)
Add support for building the CEF binary distribution using Bazel
and the default platform toolchain. Tested to work for Windows
x64, MacOS ARM64 and x64 (cross-compile from ARM64), and
Linux x64. Windows x86 (cross-compile from x64) is known to
be broken, see https://github.com/bazelbuild/bazel/issues/22164.

Includes minor changes to tests directory structure to meet
Bazel build requirements.
2024-07-28 18:19:47 +00:00
Nik Pavlov d470cf8204 Add CefTaskManager API
See https://tests/task_manager example in cefclient.
2024-07-18 11:34:41 -04:00
Nik Pavlov 231701d98b Expose DumpWithoutCrashing (fixes #3588) 2024-07-02 18:08:16 +00:00
Marshall Greenblatt b6842f8b80 Remove unused cef_ptr_util.h 2024-05-26 13:45:30 -04:00
Marshall Greenblatt 17a1fd62ec tests: Remove extension tests (see #3685)
The Alloy extension API is deprecated and these tests have not been
supported for some time.
2024-05-03 15:23:35 -04:00
reito 260dd0ca24 osr: Implement shared texture support (fixes #1006, fixes #2575)
Adds support for the OnAcceleratedPaint callback. Verified to work
on macOS and Windows. Linux support is present but not implemented
for cefclient, so it is not verified to work.

To test:
Run `cefclient --off-screen-rendering-enabled --shared-texture-enabled`
2024-04-23 13:03:56 -04:00
Marshall Greenblatt dca0435d2f 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]`
2024-04-22 14:57:37 -04:00
Marshall Greenblatt d10cc16236 distrib: Add missing cef_color_id_macros.inc (see #3671) 2024-04-11 11:35:55 -04:00
Marshall Greenblatt 2e33954032 cefclient: Add missing draggable.html resource reference 2024-04-11 11:24:26 -04:00
Marshall Greenblatt b8f91c5431 Add callbacks for unresponsive render process (fixes #3661)
The client can optionally wait or terminate the render process.

Expose process exit codes via OnRenderProcessTerminated and
CefGetExitCode (fixes #2126).

cefclient: Add a new https://tests/hang page for testing hang behavior.

cefclient: Move message and resource handling to a new BaseClientHandler
class to support loading of test pages in default Chrome UI windows.
2024-03-18 17:45:31 -04:00
Nik Pavlov 44323082b1 Add binary format support to CefMessageRouter (fixes #3502) 2023-10-25 18:20:55 +00:00
Marshall Greenblatt 57d7d89b53 Remove cef_template_util.h (see #3362)
This file is no longer required after cherry-picking C++17 migration
changes from https://crbug.com/1320019.

This also fixes compile errors with Xcode 15:
__has_trivial_destructor is deprecated; use __is_trivially_destructible instead
2023-09-20 12:07:46 -04:00
Marshall Greenblatt e53bff712a Delete cef_basictypes.h which is no longer required (fixes #3507) 2023-06-01 19:32:36 +03:00
Marshall Greenblatt 5707889555 Add methods for configuring website/content settings (fixes #3490)
This approach is now used to allow popups on a case-by-case basis in
tests instead of globally disabling the popup blocker with the Chrome
runtime.
2023-05-25 11:15:06 +00:00
Nik Pavlov c83b3cda24 views: mac: Support dynamic resize of title bar height (see #3189)
This is intended for usage with frameless windows that show the standard window
buttons, where resizing the title bar height changes the button offset. Returning a
different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of
the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the
title bar height.

To test:
1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window`
2. Enter a new value for title bar height and click the "Set Titlebar Height" button
2023-03-16 17:19:50 +00:00
Marshall Greenblatt 13f2282754 chrome: cefclient: Add default handler for request tests (see issue #3444)
Support loading of request tests (e.g. http://tests/other_tests) inside default
browsers created via "New window" and "New incognito window" commands.
2023-02-17 16:01:22 -05:00
Marshall Greenblatt 882bc19fdd cefclient: views: Support window state restore (see issue #3359)
The cefclient sample app will persist window state across application restart
if run with views, cache_path and persist_user_references enabled.

To test:
1. Run `cefclient --use-views --cache-path=/path/to/cache --persist-user-preferences`
2. Move or resize the window, maximize, minimize, etc.
3. Exit cefclient.
4. Run cefclient again with the same arguments. The previous window state will
   be restored.
2022-10-28 14:28:53 -04:00
Marshall Greenblatt 07bf5dbacc windows: Configure stack size for executables (fixes issue #3250)
Change the default stack size to 8 MiB for 64-bit and 0.5 MiB for 32-bit.

CEF's main thread needs at least a 1.5 MiB stack size in order to avoid
stack overflow crashes. However, if this is set in the PE file then other
threads get this size as well, leading to address-space exhaustion in 32-bit
CEF. A new CefRunWinMainWithPreferredStackSize function uses fibers to switch
the main thread to a 4 MiB stack (roughly the same effective size as the
64-bit build's 8 MiB stack) before running any other code.

This change additionally moves the existing Windows-only functions
CefSetOSModalLoop and CefEnableHighDPISupport from cef_app.h to cef_win.h.
2022-10-21 14:52:50 -04:00
Marshall Greenblatt 5ea0c141b5 Convert base::size to std::size from C++17 (see issue #3362) 2022-09-05 16:31:47 -04:00
Marshall Greenblatt ecb29b7fa5 alloy: Fix OnCertificateError callback for requests redirected to HTTPS (fixes issue #3364)
This change also adds initial unit test coverage for OnCertificateError (see issue #3148).
2022-08-09 13:31:18 -04:00
Marshall Greenblatt 18dac30874 Support configuration of the CefTestServer certificate type (see issue #3348) 2022-08-04 12:37:12 -04:00
Marshall Greenblatt dcd4a0077c Include net test data in the binary distribution (see issue #3348) 2022-08-03 16:28:52 -04:00
Marshall Greenblatt 46e1c4f177 ceftests: Add HSTS redirect test (see issue #3336, see issue #3348) 2022-08-03 12:14:51 -04:00