Fix autofill popup position when the popup is spawned from a webview (#13184)

This commit is contained in:
Heilig Benedek 2018-06-18 17:15:37 +02:00 committed by Charles Kerr
parent fe94bf7c1d
commit 90911a423a
5 changed files with 35 additions and 9 deletions

View file

@ -1035,8 +1035,19 @@ void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host,
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) {
bool offscreen = IsOffScreen() || (embedder_ && embedder_->IsOffScreen());
CommonWebContentsDelegate::ShowAutofillPopup(offscreen, frame_host, bounds,
values, labels);
gfx::RectF popup_bounds(bounds);
content::RenderFrameHost* embedder_frame_host = nullptr;
if (embedder_) {
auto* embedder_view = embedder_->web_contents()->GetMainFrame()->GetView();
auto* view = web_contents()->GetMainFrame()->GetView();
auto offset = view->GetViewBounds().origin() -
embedder_view->GetViewBounds().origin();
popup_bounds.Offset(offset.x(), offset.y());
embedder_frame_host = embedder_->web_contents()->GetMainFrame();
}
CommonWebContentsDelegate::ShowAutofillPopup(
frame_host, embedder_frame_host, offscreen, popup_bounds, values, labels);
}
#endif