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

Side by Side Diff: components/test_runner/event_sender.h

Issue 1855513002: Consider isPrimary and pointerType when preventing compat mouse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Running "cl format" Created 4 years, 8 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
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 5 #ifndef COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 6 #define COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 #include <unordered_map>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "third_party/WebKit/public/platform/WebDragData.h" 19 #include "third_party/WebKit/public/platform/WebDragData.h"
19 #include "third_party/WebKit/public/platform/WebInputEventResult.h" 20 #include "third_party/WebKit/public/platform/WebInputEventResult.h"
20 #include "third_party/WebKit/public/platform/WebPoint.h" 21 #include "third_party/WebKit/public/platform/WebPoint.h"
21 #include "third_party/WebKit/public/web/WebDragOperation.h" 22 #include "third_party/WebKit/public/web/WebDragOperation.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void Install(blink::WebFrame*); 56 void Install(blink::WebFrame*);
56 void SetDelegate(WebTestDelegate*); 57 void SetDelegate(WebTestDelegate*);
57 void SetWebView(blink::WebView*); 58 void SetWebView(blink::WebView*);
58 59
59 void SetContextMenuData(const blink::WebContextMenuData&); 60 void SetContextMenuData(const blink::WebContextMenuData&);
60 61
61 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask); 62 void DoDragDrop(const blink::WebDragData&, blink::WebDragOperationsMask);
62 63
63 void MouseDown(int button_number, int modifiers); 64 void MouseDown(int button_number, int modifiers);
64 void MouseUp(int button_number, int modifiers); 65 void MouseUp(int button_number, int modifiers);
66 void PointerDown(int button_number,
67 int modifiers,
68 blink::WebPointerProperties::PointerType,
69 int pointerId);
70 void PointerUp(int button_number,
71 int modifiers,
72 blink::WebPointerProperties::PointerType,
73 int pointerId);
65 void SetMouseButtonState(int button_number, int modifiers); 74 void SetMouseButtonState(int button_number, int modifiers);
66 75
67 void KeyDown(const std::string& code_str, 76 void KeyDown(const std::string& code_str,
68 int modifiers, 77 int modifiers,
69 KeyLocationCode location); 78 KeyLocationCode location);
70 79
71 void set_send_wheel_gestures(bool send_wheel_gestures) { 80 void set_send_wheel_gestures(bool send_wheel_gestures) {
72 send_wheel_gestures_ = send_wheel_gestures; 81 send_wheel_gestures_ = send_wheel_gestures;
73 } 82 }
74 83
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 MouseScrollType scroll_type, 184 MouseScrollType scroll_type,
176 blink::WebMouseWheelEvent* event, 185 blink::WebMouseWheelEvent* event,
177 bool* send_gestures); 186 bool* send_gestures);
178 void InitPointerProperties(gin::Arguments* args, 187 void InitPointerProperties(gin::Arguments* args,
179 blink::WebPointerProperties* e, 188 blink::WebPointerProperties* e,
180 float* radius_x, 189 float* radius_x,
181 float* radius_y); 190 float* radius_y);
182 191
183 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation); 192 void FinishDragAndDrop(const blink::WebMouseEvent&, blink::WebDragOperation);
184 193
185 void DoMouseUp(const blink::WebMouseEvent&); 194 void DoDragAfterMouseUp(const blink::WebMouseEvent&);
186 void DoMouseMove(const blink::WebMouseEvent&); 195 void DoDragAfterMouseMove(const blink::WebMouseEvent&);
187 void ReplaySavedEvents(); 196 void ReplaySavedEvents();
188 blink::WebInputEventResult HandleInputEventOnViewOrPopup( 197 blink::WebInputEventResult HandleInputEventOnViewOrPopup(
189 const blink::WebInputEvent&); 198 const blink::WebInputEvent&);
190 199
191 void SendGesturesForMouseWheelEvent( 200 void SendGesturesForMouseWheelEvent(
192 const blink::WebMouseWheelEvent wheel_event); 201 const blink::WebMouseWheelEvent wheel_event);
193 202
194 double last_event_timestamp() { return last_event_timestamp_; } 203 double last_event_timestamp() { return last_event_timestamp_; }
195 204
196 bool force_layout_on_events() const { return force_layout_on_events_; } 205 bool force_layout_on_events() const { return force_layout_on_events_; }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 bool touch_cancelable_; 264 bool touch_cancelable_;
256 std::vector<blink::WebTouchPoint> touch_points_; 265 std::vector<blink::WebTouchPoint> touch_points_;
257 266
258 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_; 267 scoped_ptr<blink::WebContextMenuData> last_context_menu_data_;
259 268
260 blink::WebDragData current_drag_data_; 269 blink::WebDragData current_drag_data_;
261 270
262 // Location of the touch point that initiated a gesture. 271 // Location of the touch point that initiated a gesture.
263 blink::WebPoint current_gesture_location_; 272 blink::WebPoint current_gesture_location_;
264 273
265 // Last pressed mouse button (Left/Right/Middle or None).
266 static blink::WebMouseEvent::Button pressed_button_;
267 274
268 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to 275 // Mouse-like pointer properties.
269 // currently pressed buttons of mouse. 276 struct PointerState {
270 static int current_buttons_; 277 // Last pressed button (Left/Right/Middle or None).
278 blink::WebMouseEvent::Button pressed_button_;
271 279
272 static int modifiers_; 280 // A bitwise OR of the WebMouseEvent::*ButtonDown values corresponding to
281 // currently pressed buttons of the pointer (e.g. pen or mouse).
282 int current_buttons_;
283
284 // Location of last mouseMoveTo event of this pointer.
285 blink::WebPoint last_pos_;
286
287 int modifiers_;
288
289 PointerState()
290 : pressed_button_(blink::WebMouseEvent::ButtonNone)
291 , current_buttons_(0)
292 , last_pos_(blink::WebPoint(0, 0))
293 , modifiers_(0) { }
294 };
295 typedef std::unordered_map<int, PointerState> PointerStateMap;
296 PointerStateMap current_pointer_state_;
273 297
274 bool replaying_saved_events_; 298 bool replaying_saved_events_;
275 299
276 std::deque<SavedEvent> mouse_event_queue_; 300 std::deque<SavedEvent> mouse_event_queue_;
277 301
278 blink::WebDragOperationsMask current_drag_effects_allowed_; 302 blink::WebDragOperationsMask current_drag_effects_allowed_;
279 303
280 // Location of last mouseMoveTo event.
281 static blink::WebPoint last_mouse_pos_;
282
283 // Time and place of the last mouse up event. 304 // Time and place of the last mouse up event.
284 double last_click_time_sec_; 305 double last_click_time_sec_;
285 blink::WebPoint last_click_pos_; 306 blink::WebPoint last_click_pos_;
286 307
287 // The last button number passed to mouseDown and mouseUp. 308 // The last button number passed to mouseDown and mouseUp.
288 // Used to determine whether the click count continues to increment or not. 309 // Used to determine whether the click count continues to increment or not.
289 static blink::WebMouseEvent::Button last_button_type_; 310 static blink::WebMouseEvent::Button last_button_type_;
290 311
291 blink::WebDragOperation current_drag_effect_; 312 blink::WebDragOperation current_drag_effect_;
292 313
293 uint32_t time_offset_ms_; 314 uint32_t time_offset_ms_;
294 int click_count_; 315 int click_count_;
295 // Timestamp (in seconds) of the last event that was dispatched 316 // Timestamp (in seconds) of the last event that was dispatched
296 double last_event_timestamp_; 317 double last_event_timestamp_;
297 318
298 base::WeakPtrFactory<EventSender> weak_factory_; 319 base::WeakPtrFactory<EventSender> weak_factory_;
299 320
300 DISALLOW_COPY_AND_ASSIGN(EventSender); 321 DISALLOW_COPY_AND_ASSIGN(EventSender);
301 }; 322 };
302 323
303 } // namespace test_runner 324 } // namespace test_runner
304 325
305 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_ 326 #endif // COMPONENTS_TEST_RUNNER_EVENT_SENDER_H_
OLDNEW
« no previous file with comments | « no previous file | components/test_runner/event_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698