wo/packaging/engines/wo-cef.patch
2026-10-25 23:44:14 -04:00

55 lines
2.6 KiB
Diff

diff --git a/include/cef_browser.h b/include/cef_browser.h
index 2d31eca..21f40eb 100644
--- a/include/cef_browser.h
+++ b/include/cef_browser.h
@@ -814,8 +814,10 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
/// Set the maximum rate in frames per second (fps) that CefRenderHandler::
/// OnPaint will be called for a windowless browser. The actual fps may be
/// lower if the browser cannot generate frames at the requested rate. The
- /// minimum value is 1 and the default value is 30. Can also be set at browser
- /// creation via CefBrowserSettings.windowless_frame_rate.
+ /// minimum value is 1 and the default value is 30. There is no fixed upper
+ /// frame-rate cap; callers should provide the refresh rate of the display
+ /// containing the window and update it when that rate changes. Can also be
+ /// set at browser creation via CefBrowserSettings.windowless_frame_rate.
///
/*--cef()--*/
virtual void SetWindowlessFrameRate(int frame_rate) = 0;
diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h
index aef516c..fe916b4 100644
--- a/include/internal/cef_types.h
+++ b/include/internal/cef_types.h
@@ -605,8 +605,10 @@ typedef struct _cef_browser_settings_t {
/// The maximum rate in frames per second (fps) that CefRenderHandler::OnPaint
/// will be called for a windowless browser. The actual fps may be lower if
/// the browser cannot generate frames at the requested rate. The minimum
- /// value is 1 and the default value is 30. This value can also be changed
- /// dynamically via CefBrowserHost::SetWindowlessFrameRate.
+ /// value is 1 and the default value is 30. Set a per-window display refresh
+ /// rate and update it when that window moves to a display with a different
+ /// refresh rate. This value can also be changed dynamically via
+ /// CefBrowserHost::SetWindowlessFrameRate.
///
int windowless_frame_rate;
diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc
index 8135ee0..4e334ed 100644
--- a/libcef/browser/osr/render_widget_host_view_osr.cc
+++ b/libcef/browser/osr/render_widget_host_view_osr.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <algorithm>
#include <memory>
#include <utility>
@@ -1820,7 +1821,7 @@ void CefRenderWidgetHostViewOSR::SetFrameRate() {
int frame_rate =
osr_util::ClampFrameRate(browser->settings().windowless_frame_rate);
- frame_rate_threshold_us_ = 1000000 / frame_rate;
+ frame_rate_threshold_us_ = std::max(1, 1000000 / frame_rate);
if (compositor_) {
compositor_->SetDisplayVSyncParameters(