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

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

Issue 1391843006: Embed keyboard shortcut bit in WebKeyboardEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 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 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 } 1037 }
1038 1038
1039 void RenderWidget::OnSwapBuffersComplete() { 1039 void RenderWidget::OnSwapBuffersComplete() {
1040 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersComplete"); 1040 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersComplete");
1041 1041
1042 // Notify subclasses that composited rendering was flushed to the screen. 1042 // Notify subclasses that composited rendering was flushed to the screen.
1043 DidFlushPaint(); 1043 DidFlushPaint();
1044 } 1044 }
1045 1045
1046 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, 1046 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
1047 const ui::LatencyInfo& latency_info, 1047 const ui::LatencyInfo& latency_info) {
1048 bool is_keyboard_shortcut) {
1049 if (!input_event) 1048 if (!input_event)
1050 return; 1049 return;
1051 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, 1050 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_,
1052 true); 1051 true);
1053 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( 1052 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter(
1054 &handling_event_type_, input_event->type); 1053 &handling_event_type_, input_event->type);
1055 1054
1056 // Calls into |didOverscroll()| while handling this event will populate 1055 // Calls into |didOverscroll()| while handling this event will populate
1057 // |event_overscroll|, which in turn will be bundled with the event ack. 1056 // |event_overscroll|, which in turn will be bundled with the event ack.
1058 scoped_ptr<DidOverscrollParams> event_overscroll; 1057 scoped_ptr<DidOverscrollParams> event_overscroll;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 bool processed = prevent_default; 1149 bool processed = prevent_default;
1151 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) { 1150 if (input_event->type != WebInputEvent::Char || !suppress_next_char_events_) {
1152 suppress_next_char_events_ = false; 1151 suppress_next_char_events_ = false;
1153 if (!processed && webwidget_) 1152 if (!processed && webwidget_)
1154 processed = webwidget_->handleInputEvent(*input_event); 1153 processed = webwidget_->handleInputEvent(*input_event);
1155 } 1154 }
1156 1155
1157 // If this RawKeyDown event corresponds to a browser keyboard shortcut and 1156 // If this RawKeyDown event corresponds to a browser keyboard shortcut and
1158 // it's not processed by webkit, then we need to suppress the upcoming Char 1157 // it's not processed by webkit, then we need to suppress the upcoming Char
1159 // events. 1158 // events.
1160 if (!processed && is_keyboard_shortcut) 1159 if (!processed && input_event->type == WebInputEvent::RawKeyDown &&
tdresser 2015/10/13 13:19:47 I have a slight preference for: bool is_keyboard_
jdduke (slow) 2015/10/13 16:13:03 Done.
1160 static_cast<const WebKeyboardEvent*>(input_event)->isBrowserShortcut) {
1161 suppress_next_char_events_ = true; 1161 suppress_next_char_events_ = true;
1162 }
1162 1163
1163 InputEventAckState ack_result = processed ? 1164 InputEventAckState ack_result = processed ?
1164 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1165 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1165 if (!processed && input_event->type == WebInputEvent::TouchStart) { 1166 if (!processed && input_event->type == WebInputEvent::TouchStart) {
1166 const WebTouchEvent& touch_event = 1167 const WebTouchEvent& touch_event =
1167 *static_cast<const WebTouchEvent*>(input_event); 1168 *static_cast<const WebTouchEvent*>(input_event);
1168 // Hit-test for all the pressed touch points. If there is a touch-handler 1169 // Hit-test for all the pressed touch points. If there is a touch-handler
1169 // for any of the touch points, then the renderer should continue to receive 1170 // for any of the touch points, then the renderer should continue to receive
1170 // touch events. 1171 // touch events.
1171 ack_result = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 1172 ack_result = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2380 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2380 video_hole_frames_.AddObserver(frame); 2381 video_hole_frames_.AddObserver(frame);
2381 } 2382 }
2382 2383
2383 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2384 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2384 video_hole_frames_.RemoveObserver(frame); 2385 video_hole_frames_.RemoveObserver(frame);
2385 } 2386 }
2386 #endif // defined(VIDEO_HOLE) 2387 #endif // defined(VIDEO_HOLE)
2387 2388
2388 } // namespace content 2389 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698