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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 574583002: Do not release capture when clicking to open select box (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // Setting the transient child allows for the popup to get mouse events when 509 // Setting the transient child allows for the popup to get mouse events when
510 // in a system modal dialog. 510 // in a system modal dialog.
511 // This fixes crbug.com/328593. 511 // This fixes crbug.com/328593.
512 if (transient_window_client) { 512 if (transient_window_client) {
513 transient_window_client->AddTransientChild( 513 transient_window_client->AddTransientChild(
514 popup_parent_host_view_->window_, window_); 514 popup_parent_host_view_->window_, window_);
515 } 515 }
516 516
517 SetBounds(bounds_in_screen); 517 SetBounds(bounds_in_screen);
518 Show(); 518 Show();
519 #if !defined(OS_WIN) && !defined(OS_CHROMEOS) 519 if (NeedsMouseCapture())
520 if (NeedsInputGrab())
521 window_->SetCapture(); 520 window_->SetCapture();
522 #endif
523 521
524 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this)); 522 event_filter_for_popup_exit_.reset(new EventFilterForPopupExit(this));
525 } 523 }
526 524
527 void RenderWidgetHostViewAura::InitAsFullscreen( 525 void RenderWidgetHostViewAura::InitAsFullscreen(
528 RenderWidgetHostView* reference_host_view) { 526 RenderWidgetHostView* reference_host_view) {
529 is_fullscreen_ = true; 527 is_fullscreen_ = true;
530 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); 528 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
531 window_->Init(aura::WINDOW_LAYER_TEXTURED); 529 window_->Init(aura::WINDOW_LAYER_TEXTURED);
532 window_->SetName("RenderWidgetHostViewAura"); 530 window_->SetName("RenderWidgetHostViewAura");
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 } 1860 }
1863 1861
1864 switch (event->type()) { 1862 switch (event->type()) {
1865 case ui::ET_MOUSE_PRESSED: 1863 case ui::ET_MOUSE_PRESSED:
1866 window_->SetCapture(); 1864 window_->SetCapture();
1867 // Confirm existing composition text on mouse click events, to make sure 1865 // Confirm existing composition text on mouse click events, to make sure
1868 // the input caret won't be moved with an ongoing composition text. 1866 // the input caret won't be moved with an ongoing composition text.
1869 FinishImeCompositionSession(); 1867 FinishImeCompositionSession();
1870 break; 1868 break;
1871 case ui::ET_MOUSE_RELEASED: 1869 case ui::ET_MOUSE_RELEASED:
1872 window_->ReleaseCapture(); 1870 if (!NeedsMouseCapture())
1871 window_->ReleaseCapture();
oshima 2014/09/16 16:17:24 who is closing the popup in this case?
pkotwicz 2014/09/17 02:27:58 The popup is closed when - The user clicks somewhe
1873 break; 1872 break;
1874 default: 1873 default:
1875 break; 1874 break;
1876 } 1875 }
1877 1876
1878 // Needed to propagate mouse event to |window_->parent()->delegate()|, but 1877 // Needed to propagate mouse event to |window_->parent()->delegate()|, but
1879 // note that it might be something other than a WebContentsViewAura instance. 1878 // note that it might be something other than a WebContentsViewAura instance.
1880 // TODO(pkotwicz): Find a better way of doing this. 1879 // TODO(pkotwicz): Find a better way of doing this.
1881 // In fullscreen mode which is typically used by flash, don't forward 1880 // In fullscreen mode which is typically used by flash, don't forward
1882 // the mouse events to the parent. The renderer and the plugin process 1881 // the mouse events to the parent. The renderer and the plugin process
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 aura::Window* root_window = window_->GetRootWindow(); 2196 aura::Window* root_window = window_->GetRootWindow();
2198 if (!root_window) 2197 if (!root_window)
2199 return NULL; 2198 return NULL;
2200 return root_window->GetProperty(aura::client::kRootWindowInputMethodKey); 2199 return root_window->GetProperty(aura::client::kRootWindowInputMethodKey);
2201 } 2200 }
2202 2201
2203 bool RenderWidgetHostViewAura::NeedsInputGrab() { 2202 bool RenderWidgetHostViewAura::NeedsInputGrab() {
2204 return popup_type_ == blink::WebPopupTypeSelect; 2203 return popup_type_ == blink::WebPopupTypeSelect;
2205 } 2204 }
2206 2205
2206 bool RenderWidgetHostViewAura::NeedsMouseCapture() {
2207 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
2208 return NeedsInputGrab();
2209 #endif
2210 return false;
2211 }
2212
2207 void RenderWidgetHostViewAura::FinishImeCompositionSession() { 2213 void RenderWidgetHostViewAura::FinishImeCompositionSession() {
2208 if (!has_composition_text_) 2214 if (!has_composition_text_)
2209 return; 2215 return;
2210 if (host_) { 2216 if (host_) {
2211 host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(), 2217 host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(),
2212 false); 2218 false);
2213 } 2219 }
2214 ImeCancelComposition(); 2220 ImeCancelComposition();
2215 } 2221 }
2216 2222
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 2500
2495 //////////////////////////////////////////////////////////////////////////////// 2501 ////////////////////////////////////////////////////////////////////////////////
2496 // RenderWidgetHostViewBase, public: 2502 // RenderWidgetHostViewBase, public:
2497 2503
2498 // static 2504 // static
2499 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2505 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2500 GetScreenInfoForWindow(results, NULL); 2506 GetScreenInfoForWindow(results, NULL);
2501 } 2507 }
2502 2508
2503 } // namespace content 2509 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698