From a5de549456c020fb8fdca3b9628bd45bd06b2813 Mon Sep 17 00:00:00 2001 From: Vladislav Date: Thu, 2 Apr 2020 21:14:28 +0000 Subject: [PATCH] Fix OSR popup position when the view origin is offset in screen coords (fixes issue #2902) --- libcef/browser/osr/render_widget_host_view_osr.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 509f04f53..d6840ed7e 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -555,9 +555,16 @@ void CefRenderWidgetHostViewOSR::InitAsPopup( handler->OnPopupShow(browser_impl_.get(), true); - popup_position_ = pos; + CefRect view_rect; + handler->GetViewRect(browser_impl_.get(), view_rect); + gfx::Rect client_pos(pos.x() - view_rect.x, pos.y() - view_rect.y, + pos.width(), pos.height()); + + popup_position_ = client_pos; + + CefRect widget_pos(client_pos.x(), client_pos.y(), client_pos.width(), + client_pos.height()); - CefRect widget_pos(pos.x(), pos.y(), pos.width(), pos.height()); if (handler.get()) handler->OnPopupSize(browser_impl_.get(), widget_pos);