summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Garron <lgarron@chromium.org>2015-09-04 13:13:43 -0700
committerLucas Garron <lgarron@chromium.org>2015-09-04 20:14:57 +0000
commitc379ea250199e58455bebf75cc7a5272a33f9881 (patch)
tree35e1a19c3373e9f54c26153850540193bee6c2f3
parente1cada9e53009d47879511e4eded10cb11b354c5 (diff)
downloadchromium_src-c379ea250199e58455bebf75cc7a5272a33f9881.zip
chromium_src-c379ea250199e58455bebf75cc7a5272a33f9881.tar.gz
chromium_src-c379ea250199e58455bebf75cc7a5272a33f9881.tar.bz2
Fix a mouse lock problem on Windows where in clicks outside the web page would also cause mouse lock to happen.
This fixes an issue with the mouse locking code on Windows where in if a page entered a mouse lock state and exited it via the Esc key, subsequently clicking outside the page would cause the lock prompt to display again. This was because RenderWidgetHostViewAura grabs capture on all platforms including Windows. On Windows the capture happens elsewhere in the mouse handler. However when the mouse release comes in it is possible that we are already in the mouse locked state and hence the capture is never released. Fix is to release capture on all platforms. BUG=526378 R=scheib TBR=jam Review URL: https://codereview.chromium.org/1324083002 Cr-Commit-Position: refs/heads/master@{#347122} (cherry picked from commit c922b25f080de27ebe891adff689e9b56ffeaf12) Review URL: https://codereview.chromium.org/1326123005 . Cr-Commit-Position: refs/branch-heads/2490@{#170} Cr-Branched-From: 7790a3535f2a81a03685eca31a32cf69ae0c114f-refs/heads/master@{#344925}
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc8
1 files changed, 5 insertions, 3 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 7b73a6c..ff28163 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1507,11 +1507,13 @@ void RenderWidgetHostViewAura::UnlockMouse() {
mouse_locked_ = false;
-#if !defined(OS_WIN)
- window_->ReleaseCapture();
-#else
+ if (window_->HasCapture())
+ window_->ReleaseCapture();
+
+#if defined(OS_WIN)
::ClipCursor(NULL);
#endif
+
window_->MoveCursorTo(unlocked_mouse_position_);
aura::client::CursorClient* cursor_client =
aura::client::GetCursorClient(root_window);