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

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

Issue 76283003: touch: Fix touch-event hit-testing for multiple touch points. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
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/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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 using blink::WebPagePopup; 90 using blink::WebPagePopup;
91 using blink::WebPopupMenu; 91 using blink::WebPopupMenu;
92 using blink::WebPopupMenuInfo; 92 using blink::WebPopupMenuInfo;
93 using blink::WebPopupType; 93 using blink::WebPopupType;
94 using blink::WebRange; 94 using blink::WebRange;
95 using blink::WebRect; 95 using blink::WebRect;
96 using blink::WebScreenInfo; 96 using blink::WebScreenInfo;
97 using blink::WebSize; 97 using blink::WebSize;
98 using blink::WebTextDirection; 98 using blink::WebTextDirection;
99 using blink::WebTouchEvent; 99 using blink::WebTouchEvent;
100 using blink::WebTouchPoint;
100 using blink::WebVector; 101 using blink::WebVector;
101 using blink::WebWidget; 102 using blink::WebWidget;
102 103
103 namespace { 104 namespace {
104 105
105 typedef std::map<std::string, ui::TextInputMode> TextInputModeMap; 106 typedef std::map<std::string, ui::TextInputMode> TextInputModeMap;
106 107
107 class TextInputModeMapSingleton { 108 class TextInputModeMapSingleton {
108 public: 109 public:
109 static TextInputModeMapSingleton* GetInstance() { 110 static TextInputModeMapSingleton* GetInstance() {
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 // it's not processed by webkit, then we need to suppress the upcoming Char 1109 // it's not processed by webkit, then we need to suppress the upcoming Char
1109 // events. 1110 // events.
1110 if (!processed && is_keyboard_shortcut) 1111 if (!processed && is_keyboard_shortcut)
1111 suppress_next_char_events_ = true; 1112 suppress_next_char_events_ = true;
1112 1113
1113 InputEventAckState ack_result = processed ? 1114 InputEventAckState ack_result = processed ?
1114 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1115 INPUT_EVENT_ACK_STATE_CONSUMED : INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1115 if (!processed && input_event->type == WebInputEvent::TouchStart) { 1116 if (!processed && input_event->type == WebInputEvent::TouchStart) {
1116 const WebTouchEvent& touch_event = 1117 const WebTouchEvent& touch_event =
1117 *static_cast<const WebTouchEvent*>(input_event); 1118 *static_cast<const WebTouchEvent*>(input_event);
1118 ack_result = HasTouchEventHandlersAt(touch_event.touches[0].position) ? 1119 // Hit-test for all the pressed touch points. If there is a touch-handler
1119 INPUT_EVENT_ACK_STATE_NOT_CONSUMED : 1120 // for any of the touch points, then the renderer should continue to receive
1120 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; 1121 // touch events.
1122 ack_result = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
1123 for (size_t i = 0; i < touch_event.touchesLength; ++i) {
1124 if (touch_event.touches[i].state == WebTouchPoint::StatePressed &&
1125 HasTouchEventHandlersAt(touch_event.touches[i].position)) {
1126 ack_result = INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1127 break;
1128 }
1129 }
1121 } 1130 }
1122 1131
1123 IPC::Message* response = 1132 IPC::Message* response =
1124 new InputHostMsg_HandleInputEvent_ACK(routing_id_, 1133 new InputHostMsg_HandleInputEvent_ACK(routing_id_,
1125 input_event->type, 1134 input_event->type,
1126 ack_result, 1135 ack_result,
1127 latency_info); 1136 latency_info);
1128 bool event_type_can_be_rate_limited = 1137 bool event_type_can_be_rate_limited =
1129 input_event->type == WebInputEvent::MouseMove || 1138 input_event->type == WebInputEvent::MouseMove ||
1130 input_event->type == WebInputEvent::MouseWheel || 1139 input_event->type == WebInputEvent::MouseWheel ||
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 GetURLForGraphicsContext3D(), 2823 GetURLForGraphicsContext3D(),
2815 gpu_channel_host.get(), 2824 gpu_channel_host.get(),
2816 use_echo_for_swap_ack, 2825 use_echo_for_swap_ack,
2817 attributes, 2826 attributes,
2818 false /* bind generates resources */, 2827 false /* bind generates resources */,
2819 limits)); 2828 limits));
2820 return context.Pass(); 2829 return context.Pass();
2821 } 2830 }
2822 2831
2823 } // namespace content 2832 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_proxy_unittest.cc ('k') | content/renderer/render_widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698