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:
@ -5,6 +5,7 @@
|
||||
#include "cef/libcef/browser/native/browser_platform_delegate_native.h"
|
||||
|
||||
#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
@ -24,3 +25,25 @@ void CefBrowserPlatformDelegateNative::WasResized() {
|
||||
host->GetWidget()->SynchronizeVisualProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNative::NotifyScreenInfoChanged() {
|
||||
content::RenderWidgetHostImpl* render_widget_host = nullptr;
|
||||
if (web_contents_) {
|
||||
if (auto* rvh = web_contents_->GetRenderViewHost()) {
|
||||
render_widget_host =
|
||||
content::RenderWidgetHostImpl::From(rvh->GetWidget());
|
||||
}
|
||||
}
|
||||
if (!render_widget_host) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send updated screen bounds information to the renderer process.
|
||||
if (render_widget_host->delegate()) {
|
||||
render_widget_host->delegate()->SendScreenRects();
|
||||
} else {
|
||||
render_widget_host->SendScreenRects();
|
||||
}
|
||||
|
||||
render_widget_host->NotifyScreenInfoChanged();
|
||||
}
|
||||
|
Reference in New Issue
Block a user