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

Side by Side Diff: content/renderer/render_widget.cc

Issue 7863003: Mouse lock implementation, including the renderer side and the Windows version of the browser side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove two tab chars. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 439 }
440 440
441 const WebInputEvent* input_event = 441 const WebInputEvent* input_event =
442 reinterpret_cast<const WebInputEvent*>(data); 442 reinterpret_cast<const WebInputEvent*>(data);
443 443
444 bool is_keyboard_shortcut = false; 444 bool is_keyboard_shortcut = false;
445 // is_keyboard_shortcut flag is only available for RawKeyDown events. 445 // is_keyboard_shortcut flag is only available for RawKeyDown events.
446 if (input_event->type == WebInputEvent::RawKeyDown) 446 if (input_event->type == WebInputEvent::RawKeyDown)
447 message.ReadBool(&iter, &is_keyboard_shortcut); 447 message.ReadBool(&iter, &is_keyboard_shortcut);
448 448
449 bool processed = false; 449 bool mouse_event_absorbed = false;
brettw 2011/09/14 22:17:58 I think this would be more clear if this were call
yzshen1 2011/09/19 20:48:41 Done. It looks much better.
450 if (WebInputEvent::isMouseEventType(input_event->type)) {
451 mouse_event_absorbed = BeforeHandleMouseEvent(
brettw 2011/09/14 22:17:58 Can you rename this to "WillHandleMouseEvent" whic
yzshen1 2011/09/19 20:48:41 Done.
452 *(static_cast<const WebMouseEvent*>(input_event)));
453 }
454
455 bool processed = mouse_event_absorbed;
450 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { 456 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) {
451 suppress_next_char_events_ = false; 457 suppress_next_char_events_ = false;
452 if (webwidget_) 458 if (!processed && webwidget_)
453 processed = webwidget_->handleInputEvent(*input_event); 459 processed = webwidget_->handleInputEvent(*input_event);
454 } 460 }
455 461
456 // If this RawKeyDown event corresponds to a browser keyboard shortcut and 462 // If this RawKeyDown event corresponds to a browser keyboard shortcut and
457 // it's not processed by webkit, then we need to suppress the upcoming Char 463 // it's not processed by webkit, then we need to suppress the upcoming Char
458 // events. 464 // events.
459 if (!processed && is_keyboard_shortcut) 465 if (!processed && is_keyboard_shortcut)
460 suppress_next_char_events_ = true; 466 suppress_next_char_events_ = true;
461 467
462 IPC::Message* response = new ViewHostMsg_HandleInputEvent_ACK(routing_id_); 468 IPC::Message* response = new ViewHostMsg_HandleInputEvent_ACK(routing_id_);
(...skipping 14 matching lines...) Expand all
477 } 483 }
478 pending_input_event_ack_.reset(response); 484 pending_input_event_ack_.reset(response);
479 } else { 485 } else {
480 Send(response); 486 Send(response);
481 } 487 }
482 488
483 handling_input_event_ = false; 489 handling_input_event_ = false;
484 490
485 if (WebInputEvent::isKeyboardEventType(input_event->type)) 491 if (WebInputEvent::isKeyboardEventType(input_event->type))
486 DidHandleKeyEvent(); 492 DidHandleKeyEvent();
487 if (WebInputEvent::isMouseEventType(input_event->type)) 493 if (!mouse_event_absorbed &&
494 WebInputEvent::isMouseEventType(input_event->type)) {
488 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event))); 495 DidHandleMouseEvent(*(static_cast<const WebMouseEvent*>(input_event)));
496 }
489 } 497 }
490 498
491 void RenderWidget::OnMouseCaptureLost() { 499 void RenderWidget::OnMouseCaptureLost() {
492 if (webwidget_) 500 if (webwidget_)
493 webwidget_->mouseCaptureLost(); 501 webwidget_->mouseCaptureLost();
494 } 502 }
495 503
496 void RenderWidget::OnSetFocus(bool enable) { 504 void RenderWidget::OnSetFocus(bool enable) {
497 has_focus_ = enable; 505 has_focus_ = enable;
498 if (webwidget_) 506 if (webwidget_)
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1392
1385 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { 1393 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
1386 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); 1394 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin();
1387 i != plugin_window_moves_.end(); ++i) { 1395 i != plugin_window_moves_.end(); ++i) {
1388 if (i->window == window) { 1396 if (i->window == window) {
1389 plugin_window_moves_.erase(i); 1397 plugin_window_moves_.erase(i);
1390 break; 1398 break;
1391 } 1399 }
1392 } 1400 }
1393 } 1401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698