brave / muon

[DEPRECATED] Build browsers and browser like applications with HTML, CSS, and JavaScript
https://discord.gg/TcT5tX2
MIT License
969 stars 114 forks source link

ShowDefinitionForSelection shows up at wrong coordinates #156

Open darkdh opened 7 years ago

darkdh commented 7 years ago

In reference to https://github.com/brave/muon/commit/62dec3b9561bc5d35976549317c40b1b6fc46b4e

content/browser/renderer_host/render_widget_host_view_mac.mm In showLookUpDictionaryOverlayFromRange(from ShowDefinitionForSelection) gfx::Rect root_box = renderWidgetHostView_->GetViewBounds(); will get 0,0 0x0 comparing to showLookUpDictionaryOverlayAtPoint (from three finger tapping) will get 0,22 1440x838 from the same selected word.

bridiver commented 7 years ago

I suppose this could potentially be a webview bug. When we have some time we should try to repro in a Chrome webview

darkdh commented 7 years ago

It starts from

atom/browser/api/atom_api_web_contents.cc

void WebContents::ShowDefinitionForSelection() {
#if defined(OS_MACOSX)
  const auto view = web_contents()->GetRenderWidgetHostView();
  if (view)
    view->ShowDefinitionForSelection();
#endif
}

and then guest_bounds and embedder_boundslook fine in RenderWidgetHostViewGuest::ShowDefinitionForSelection() of content/browser/frame_host/render_widget_host_view_guest.cc

bridiver commented 7 years ago

was there a ticket for the original issue? If not you can add it here