summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-12 18:31:00 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-12 18:31:00 +0000
commit0aa54d6fe95bd455b2f0079e5304d510c9e15bc2 (patch)
tree04e46bc0c076ba953115cf1cbdae4813ba07491f
parent35d26373b1bd807019f15ea059779b9e3b75e1e2 (diff)
downloadchromium_src-0aa54d6fe95bd455b2f0079e5304d510c9e15bc2.zip
chromium_src-0aa54d6fe95bd455b2f0079e5304d510c9e15bc2.tar.gz
chromium_src-0aa54d6fe95bd455b2f0079e5304d510c9e15bc2.tar.bz2
Fix mouse event handling in Cocoa plugins so we still update our location information
BUG=none TEST=Context menus in Flash 10.1 content should show up at the correct location. Review URL: http://codereview.chromium.org/543022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36023 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm44
2 files changed, 25 insertions, 21 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index fee0d1d..7cec03d 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -318,7 +318,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
// Updates the internal information about where the plugin is located on
// the screen.
- void UpdateWindowLocation(const WebKit::WebMouseEvent& event);
+ void UpdatePluginLocation(const WebKit::WebMouseEvent& event);
// Moves our dummy window to the given offset relative to the last known
// location of the real renderer window's content view.
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 17b33f3..82c79a4 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -412,17 +412,21 @@ void WebPluginDelegateImpl::SetFocus() {
FocusNotify(this);
}
-void WebPluginDelegateImpl::UpdateWindowLocation(const WebMouseEvent& event) {
- last_window_x_offset_ = event.globalX - event.windowX;
- last_window_y_offset_ = event.globalY - event.windowY;
- last_mouse_x_ = event.globalX;
- last_mouse_y_ = event.globalY;
+void WebPluginDelegateImpl::UpdatePluginLocation(const WebMouseEvent& event) {
+ instance()->set_plugin_origin(gfx::Point(event.globalX - event.x,
+ event.globalY - event.y));
- instance_->set_plugin_origin(gfx::Point(event.globalX - event.x,
- event.globalY - event.y));
+#ifndef NP_NO_CARBON
+ if (instance()->event_model() == NPEventModelCarbon) {
+ last_window_x_offset_ = event.globalX - event.windowX;
+ last_window_y_offset_ = event.globalY - event.windowY;
+ last_mouse_x_ = event.globalX;
+ last_mouse_y_ = event.globalY;
- UpdateDummyWindowBoundsWithOffset(event.windowX - event.x,
- event.windowY - event.y, 0, 0);
+ UpdateDummyWindowBoundsWithOffset(event.windowX - event.x,
+ event.windowY - event.y, 0, 0);
+ }
+#endif
}
void WebPluginDelegateImpl::UpdateDummyWindowBoundsWithOffset(
@@ -702,23 +706,23 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event,
if (event.type == WebInputEvent::MouseDown && !have_focus_)
SetFocus();
+ if (WebInputEventIsWebMouseEvent(event)) {
+ // Make sure we update our plugin location tracking before we send the
+ // event to the plugin, so that any coordinate conversion the plugin does
+ // will work out.
+ const WebMouseEvent* mouse_event =
+ static_cast<const WebMouseEvent*>(&event);
+ UpdatePluginLocation(*mouse_event);
+ }
+
#ifndef NP_NO_CARBON
if (instance()->event_model() == NPEventModelCarbon) {
// If we somehow get an event before we've set up the plugin window, bail.
if (!cg_context_.context)
return false;
- if (WebInputEventIsWebMouseEvent(event)) {
- // Make sure our dummy window has the correct location before we send the
- // event to the plugin, so that any coordinate conversion the plugin does
- // will work out.
- const WebMouseEvent* mouse_event =
- static_cast<const WebMouseEvent*>(&event);
- UpdateWindowLocation(*mouse_event);
-
- if (event.type == WebInputEvent::MouseMove) {
- return true; // The recurring OnNull will send null events.
- }
+ if (event.type == WebInputEvent::MouseMove) {
+ return true; // The recurring OnNull will send null events.
}
switch (instance()->drawing_model()) {