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

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

Issue 8727010: Send one WebKeyboardEvent to the RenderWidget at a time. Move keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 needs_repainting_on_restore_(false), 84 needs_repainting_on_restore_(false),
85 has_focus_(false), 85 has_focus_(false),
86 handling_input_event_(false), 86 handling_input_event_(false),
87 closing_(false), 87 closing_(false),
88 is_swapped_out_(false), 88 is_swapped_out_(false),
89 input_method_is_active_(false), 89 input_method_is_active_(false),
90 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 90 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
91 can_compose_inline_(true), 91 can_compose_inline_(true),
92 popup_type_(popup_type), 92 popup_type_(popup_type),
93 pending_window_rect_count_(0), 93 pending_window_rect_count_(0),
94 suppress_next_char_events_(false),
95 is_accelerated_compositing_active_(false), 94 is_accelerated_compositing_active_(false),
96 animation_update_pending_(false), 95 animation_update_pending_(false),
97 animation_task_posted_(false), 96 animation_task_posted_(false),
98 invalidation_task_posted_(false) { 97 invalidation_task_posted_(false) {
99 RenderProcess::current()->AddRefProcess(); 98 RenderProcess::current()->AddRefProcess();
100 DCHECK(RenderThread::Get()); 99 DCHECK(RenderThread::Get());
101 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 100 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
102 switches::kDisableGpuVsync); 101 switches::kDisableGpuVsync);
103 } 102 }
104 103
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 int data_length; 441 int data_length;
443 handling_input_event_ = true; 442 handling_input_event_ = true;
444 if (!message.ReadData(&iter, &data, &data_length)) { 443 if (!message.ReadData(&iter, &data, &data_length)) {
445 handling_input_event_ = false; 444 handling_input_event_ = false;
446 return; 445 return;
447 } 446 }
448 447
449 const WebInputEvent* input_event = 448 const WebInputEvent* input_event =
450 reinterpret_cast<const WebInputEvent*>(data); 449 reinterpret_cast<const WebInputEvent*>(data);
451 450
452 bool is_keyboard_shortcut = false;
453 // is_keyboard_shortcut flag is only available for RawKeyDown events.
454 if (input_event->type == WebInputEvent::RawKeyDown)
455 message.ReadBool(&iter, &is_keyboard_shortcut);
456
457 bool prevent_default = false; 451 bool prevent_default = false;
458 if (WebInputEvent::isMouseEventType(input_event->type)) { 452 if (WebInputEvent::isMouseEventType(input_event->type)) {
459 prevent_default = WillHandleMouseEvent( 453 prevent_default = WillHandleMouseEvent(
460 *(static_cast<const WebMouseEvent*>(input_event))); 454 *(static_cast<const WebMouseEvent*>(input_event)));
461 } 455 }
462 456
463 bool processed = prevent_default; 457 bool processed = prevent_default;
464 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { 458 if (!processed && webwidget_)
465 suppress_next_char_events_ = false; 459 processed = webwidget_->handleInputEvent(*input_event);
466 if (!processed && webwidget_)
467 processed = webwidget_->handleInputEvent(*input_event);
468 }
469
470 // If this RawKeyDown event corresponds to a browser keyboard shortcut and
471 // it's not processed by webkit, then we need to suppress the upcoming Char
472 // events.
473 if (!processed && is_keyboard_shortcut)
474 suppress_next_char_events_ = true;
475 460
476 IPC::Message* response = 461 IPC::Message* response =
477 new ViewHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type, 462 new ViewHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type,
478 processed); 463 processed);
479 464
480 if ((input_event->type == WebInputEvent::MouseMove || 465 if ((input_event->type == WebInputEvent::MouseMove ||
481 input_event->type == WebInputEvent::MouseWheel || 466 input_event->type == WebInputEvent::MouseWheel ||
482 input_event->type == WebInputEvent::TouchMove) && 467 input_event->type == WebInputEvent::TouchMove) &&
483 paint_aggregator_.HasPendingUpdate()) { 468 paint_aggregator_.HasPendingUpdate()) {
484 // We want to rate limit the input events in this case, so we'll wait for 469 // We want to rate limit the input events in this case, so we'll wait for
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 } 1484 }
1500 } 1485 }
1501 1486
1502 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1487 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1503 return false; 1488 return false;
1504 } 1489 }
1505 1490
1506 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1491 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1507 return false; 1492 return false;
1508 } 1493 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698