Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 49383004: Ensure on Windows AURA that the cursor stays within the bounds of the window during a LockMouse ope… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/root_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
===================================================================
--- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 231601)
+++ content/browser/renderer_host/render_widget_host_view_aura.cc (working copy)
@@ -2170,7 +2170,8 @@
}
bool RenderWidgetHostViewAura::LockMouse() {
- aura::Window* root_window = window_->GetRootWindow();
+ aura::RootWindow* root_window =
+ static_cast<aura::RootWindow*>(window_->GetRootWindow());
scheib 2013/10/30 21:23:07 Why doesn't GetRootWindow() return a RootWindow?
ananta 2013/10/30 21:43:15 Checked with sky and ben. The RootWindow class is
if (!root_window)
return false;
@@ -2194,11 +2195,14 @@
}
if (aura::client::GetTooltipClient(root_window))
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false);
+
+ root_window->ConfineCursorToWindow();
return true;
}
void RenderWidgetHostViewAura::UnlockMouse() {
- aura::Window* root_window = window_->GetRootWindow();
+ aura::RootWindow* root_window =
+ static_cast<aura::RootWindow*>(window_->GetRootWindow());
if (!mouse_locked_ || !root_window)
return;
@@ -2219,6 +2223,7 @@
aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true);
host_->LostMouseLock();
+ root_window->UnConfineCursor();
}
////////////////////////////////////////////////////////////////////////////////
@@ -2730,9 +2735,19 @@
return;
}
- WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event);
gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint());
+ // If we receive non client mouse messages while we are in the locked state
+ // it probably means that the mouse left the borders of our window and
+ // needs to be moved back to the center.
+ if (event->flags() & ui::EF_IS_NON_CLIENT) {
+ synthetic_move_sent_ = true;
+ window_->MoveCursorTo(center);
+ return;
+ }
+
+ WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event);
+
bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED ||
event->type() == ui::ET_MOUSE_DRAGGED) &&
mouse_event.x == center.x() && mouse_event.y == center.y();
« no previous file with comments | « no previous file | ui/aura/root_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698