mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
namespace client {
|
||||
|
||||
struct OsrRendererSettings;
|
||||
class RootWindowMacImpl;
|
||||
|
||||
// OS X implementation of a top-level native window in the browser process.
|
||||
@@ -27,6 +28,7 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
|
||||
BrowserWindow* browser_window() const;
|
||||
RootWindow::Delegate* delegate() const;
|
||||
const OsrRendererSettings* osr_settings() const;
|
||||
|
||||
// RootWindow methods.
|
||||
void Init(RootWindow::Delegate* delegate,
|
||||
@@ -41,10 +43,15 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
CefBrowserSettings& settings) override;
|
||||
void Show(ShowMode mode) override;
|
||||
void Hide() override;
|
||||
void SetBounds(int x, int y, size_t width, size_t height) override;
|
||||
void SetBounds(int x,
|
||||
int y,
|
||||
size_t width,
|
||||
size_t height,
|
||||
bool content_bounds) override;
|
||||
bool DefaultToContentBounds() const override;
|
||||
void Close(bool force) override;
|
||||
void SetDeviceScaleFactor(float device_scale_factor) override;
|
||||
float GetDeviceScaleFactor() const override;
|
||||
std::optional<float> GetDeviceScaleFactor() const override;
|
||||
CefRefPtr<CefBrowser> GetBrowser() const override;
|
||||
ClientWindowHandle GetWindowHandle() const override;
|
||||
bool WithWindowlessRendering() const override;
|
||||
@@ -57,6 +64,10 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
void OnSetTitle(const std::string& title) override;
|
||||
void OnSetFullscreen(bool fullscreen) override;
|
||||
void OnAutoResize(const CefSize& new_size) override;
|
||||
void OnContentsBounds(const CefRect& new_bounds) override {
|
||||
RootWindow::SetBounds(new_bounds,
|
||||
/*content_bounds=*/DefaultToContentBounds());
|
||||
}
|
||||
void OnSetLoadingState(bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override;
|
||||
|
Reference in New Issue
Block a user