From 5f4bccd672c1ed745218a9d756e430f0164fd3ba Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Sat, 9 Apr 2022 14:00:09 -0400 Subject: [PATCH] Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294) This impacts both Alloy and Chrome runtimes when using a native parent window. --- libcef/browser/alloy/browser_platform_delegate_alloy.cc | 7 ++----- libcef/browser/frame_host_impl.cc | 7 ------- libcef/browser/frame_host_impl.h | 4 ---- libcef/common/mojom/cef.mojom | 4 ---- libcef/renderer/frame_impl.cc | 8 -------- libcef/renderer/frame_impl.h | 1 - 6 files changed, 2 insertions(+), 29 deletions(-) diff --git a/libcef/browser/alloy/browser_platform_delegate_alloy.cc b/libcef/browser/alloy/browser_platform_delegate_alloy.cc index 23d26945c..adbee9154 100644 --- a/libcef/browser/alloy/browser_platform_delegate_alloy.cc +++ b/libcef/browser/alloy/browser_platform_delegate_alloy.cc @@ -261,14 +261,11 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() { #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() { - if (!browser_) + if (!web_contents_) return; // Dismiss any existing popups. - auto frame = browser_->GetMainFrame(); - if (frame && frame->IsValid()) { - static_cast(frame.get())->NotifyMoveOrResizeStarted(); - } + web_contents_->ClearFocusedElement(); } #endif diff --git a/libcef/browser/frame_host_impl.cc b/libcef/browser/frame_host_impl.cc index 5891f5678..cc6ea8580 100644 --- a/libcef/browser/frame_host_impl.cc +++ b/libcef/browser/frame_host_impl.cc @@ -283,13 +283,6 @@ void CefFrameHostImpl::RefreshAttributes() { } } -void CefFrameHostImpl::NotifyMoveOrResizeStarted() { - SendToRenderFrame(__FUNCTION__, - base::BindOnce([](const RenderFrameType& render_frame) { - render_frame->MoveOrResizeStarted(); - })); -} - void CefFrameHostImpl::LoadRequest(cef::mojom::RequestParamsPtr params) { if (!url_util::FixupGURL(params->url)) return; diff --git a/libcef/browser/frame_host_impl.h b/libcef/browser/frame_host_impl.h index 1158b9f6a..96c3d493f 100644 --- a/libcef/browser/frame_host_impl.h +++ b/libcef/browser/frame_host_impl.h @@ -82,10 +82,6 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame { void SetFocused(bool focused); void RefreshAttributes(); - // Notification that a move or resize of the renderer's containing window has - // started. Used on Windows and Linux with the Alloy runtime. - void NotifyMoveOrResizeStarted(); - // Load the specified request. void LoadRequest(cef::mojom::RequestParamsPtr params); diff --git a/libcef/common/mojom/cef.mojom b/libcef/common/mojom/cef.mojom index bd710c35f..ba2248bd7 100644 --- a/libcef/common/mojom/cef.mojom +++ b/libcef/common/mojom/cef.mojom @@ -73,10 +73,6 @@ interface RenderFrame { // Loading has stopped. DidStopLoading(); - - // Move or resize of the renderer's containing window has started. Used on - // Windows and Linux with the Alloy runtime. - MoveOrResizeStarted(); }; // Interface for communicating with a frame in the browser process. diff --git a/libcef/renderer/frame_impl.cc b/libcef/renderer/frame_impl.cc index af55060ad..6342daccb 100644 --- a/libcef/renderer/frame_impl.cc +++ b/libcef/renderer/frame_impl.cc @@ -684,14 +684,6 @@ void CefFrameImpl::DidStopLoading() { OnDraggableRegionsChanged(); } -void CefFrameImpl::MoveOrResizeStarted() { - if (frame_) { - auto web_view = frame_->View(); - if (web_view) - web_view->CancelPagePopup(); - } -} - void CefFrameImpl::ContextLifecycleStateChanged( blink::mojom::blink::FrameLifecycleState state) { if (state == blink::mojom::FrameLifecycleState::kFrozen && IsMain() && diff --git a/libcef/renderer/frame_impl.h b/libcef/renderer/frame_impl.h index 01a91f8b4..622e74bae 100644 --- a/libcef/renderer/frame_impl.h +++ b/libcef/renderer/frame_impl.h @@ -142,7 +142,6 @@ class CefFrameImpl int32_t startLine) override; void LoadRequest(cef::mojom::RequestParamsPtr params) override; void DidStopLoading() override; - void MoveOrResizeStarted() override; // blink_glue::CefExecutionContextLifecycleStateObserver methods: void ContextLifecycleStateChanged(