diff options
author | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:17:23 +0000 |
---|---|---|
committer | yoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:17:23 +0000 |
commit | 628fa37cbdd3a14b358358b3f364cda81bcee41b (patch) | |
tree | c196e1e4804a643bb609beb68171e980f35e46a4 /content | |
parent | c97fd6c69dc0c6c653eb47d2a889b6fdf0c208d9 (diff) | |
download | chromium_src-628fa37cbdd3a14b358358b3f364cda81bcee41b.zip chromium_src-628fa37cbdd3a14b358358b3f364cda81bcee41b.tar.gz chromium_src-628fa37cbdd3a14b358358b3f364cda81bcee41b.tar.bz2 |
Aura: Add Window::MoveCursorTo() taking relative location to the window.
Previously, although RootWindow::MoveCursorTo() takes a ponit coordinate relative to Root, but OnMouseEvent/LockMouse in RWHVA are using coordinate relative to parent window (which may not be root). UnlockMouse is using global X/Y from webkit.
This CL added Window::MoveCursorTo() taking relative location to the window, and made RWHVA use it.
BUG=none
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/10543174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142852 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index a5aaf5f..be85018 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -715,7 +715,7 @@ bool RenderWidgetHostViewAura::LockMouse() { window_->SetCapture(); aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); synthetic_move_sent_ = true; - root_window->MoveCursorTo(window_->bounds().CenterPoint()); + window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); if (aura::client::GetTooltipClient(root_window)) aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); return true; @@ -729,7 +729,7 @@ void RenderWidgetHostViewAura::UnlockMouse() { mouse_locked_ = false; window_->ReleaseCapture(); - root_window->MoveCursorTo(unlocked_global_mouse_position_); + window_->MoveCursorTo(unlocked_mouse_position_); aura::Env::GetInstance()->cursor_manager()->ShowCursor(true); if (aura::client::GetTooltipClient(root_window)) aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); @@ -1013,11 +1013,11 @@ bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); if (mouse_locked_) { WebKit::WebMouseEvent mouse_event = content::MakeWebMouseEvent(event); - gfx::Point center = window_->bounds().CenterPoint(); + gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || event->type() == ui::ET_MOUSE_DRAGGED) && - mouse_event.globalX == center.x() && mouse_event.globalY == center.y(); + mouse_event.x == center.x() && mouse_event.y == center.y(); ModifyEventMovementAndCoords(&mouse_event); @@ -1028,7 +1028,7 @@ bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { // Check if the mouse has reached the border and needs to be centered. if (ShouldMoveToCenter()) { synthetic_move_sent_ = true; - window_->GetRootWindow()->MoveCursorTo(center); + window_->MoveCursorTo(center); } // Forward event to renderer. |