diff options
author | ekaramad <ekaramad@google.com> | 2015-09-03 11:26:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-03 18:26:38 +0000 |
commit | b205e53f3aa9a741f4dffa5726992976c517f6ee (patch) | |
tree | e7749d329bc5c88f296142a25985d309f93b40a9 /extensions/browser/guest_view | |
parent | aa6130a04131effbfa5445d03ece2dfd7197ccee (diff) | |
download | chromium_src-b205e53f3aa9a741f4dffa5726992976c517f6ee.zip chromium_src-b205e53f3aa9a741f4dffa5726992976c517f6ee.tar.gz chromium_src-b205e53f3aa9a741f4dffa5726992976c517f6ee.tar.bz2 |
Fixing the Position of Context Menu for BrowserPlugin (<webview>)
With current implementation of the BrowserPlugin, all WebMouseEvents are
routed, throught the browser (RenderWidgetHostViewGuest), to the
renderer process of the guest. The guest uses the coordinates, as passed, for creating the ContextMenu event.
Therefore, the guest renderer process is oblivious to any CSS transforms
applied on the BrowserPlugin and as a result, the reported position of
the context menu is potentially incorrect.
This patch applies a hacky solution to resolve this issue. The work
around is to store the location of the context menu from a MouseDown
event. The position is measured form the global coordinates of the mouse
event and the boundaries of the owner's view.
BUG=470087
Review URL: https://codereview.chromium.org/1293963002
Cr-Commit-Position: refs/heads/master@{#347195}
Diffstat (limited to 'extensions/browser/guest_view')
3 files changed, 9 insertions, 0 deletions
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 70dca3f..bab38da 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -567,6 +567,11 @@ void WebViewGuest::LoadAbort(bool is_top_level, new GuestViewEvent(webview::kEventLoadAbort, args.Pass())); } +void WebViewGuest::SetContextMenuPosition(const gfx::Point& position) { + if (web_view_guest_delegate_) + web_view_guest_delegate_->SetContextMenuPosition(position); +} + void WebViewGuest::CreateNewGuestWebViewWindow( const content::OpenURLParams& params) { GuestViewManager* guest_manager = diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h index 9605ad2..9144c68 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.h +++ b/extensions/browser/guest_view/web_view/web_view_guest.h @@ -354,6 +354,8 @@ class WebViewGuest : public guest_view::GuestView<WebViewGuest>, void ApplyAttributes(const base::DictionaryValue& params); + void SetContextMenuPosition(const gfx::Point& position) override; + // Identifies the set of rules registries belonging to this guest. int rules_registry_id_; diff --git a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h index 84a06f5..afee259 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h +++ b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h @@ -49,6 +49,8 @@ class WebViewGuestDelegate { // Returns true if the WebViewGuest should handle find requests for its // embedder. virtual bool ShouldHandleFindRequestsForEmbedder() const = 0; + + virtual void SetContextMenuPosition(const gfx::Point& position) = 0; }; } // namespace extensions |