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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.cc

Issue 2634183002: Support multi-button press for synthetic mouse events (Closed)
Patch Set: button Created 3 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/synthetic_web_input_event_builders.h" 5 #include "content/common/input/synthetic_web_input_event_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "ui/events/base_event_utils.h" 9 #include "ui/events/base_event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 19 matching lines...) Expand all
30 int window_x, 30 int window_x,
31 int window_y, 31 int window_y,
32 int modifiers) { 32 int modifiers) {
33 DCHECK(WebInputEvent::isMouseEventType(type)); 33 DCHECK(WebInputEvent::isMouseEventType(type));
34 WebMouseEvent result(type, modifiers, 34 WebMouseEvent result(type, modifiers,
35 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 35 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
36 result.x = window_x; 36 result.x = window_x;
37 result.y = window_y; 37 result.y = window_y;
38 result.windowX = window_x; 38 result.windowX = window_x;
39 result.windowY = window_y; 39 result.windowY = window_y;
40 40 result.setModifiers(modifiers);
41 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) 41 result.pointerType = blink::WebPointerProperties::PointerType::Mouse;
42 result.button = WebMouseEvent::Button::Left;
43 else
44 result.button = WebMouseEvent::Button::NoButton;
45
46 return result; 42 return result;
47 } 43 }
48 44
49 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( 45 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
50 WebMouseWheelEvent::Phase phase) { 46 WebMouseWheelEvent::Phase phase) {
51 WebMouseWheelEvent result(WebInputEvent::MouseWheel, 47 WebMouseWheelEvent result(WebInputEvent::MouseWheel,
52 WebInputEvent::NoModifiers, 48 WebInputEvent::NoModifiers,
53 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 49 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
54 result.phase = phase; 50 result.phase = phase;
55 return result; 51 return result;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 245
250 int SyntheticWebTouchEvent::FirstFreeIndex() { 246 int SyntheticWebTouchEvent::FirstFreeIndex() {
251 for (size_t i = 0; i < kTouchesLengthCap; ++i) { 247 for (size_t i = 0; i < kTouchesLengthCap; ++i) {
252 if (touches[i].state == WebTouchPoint::StateUndefined) 248 if (touches[i].state == WebTouchPoint::StateUndefined)
253 return i; 249 return i;
254 } 250 }
255 return -1; 251 return -1;
256 } 252 }
257 253
258 } // namespace content 254 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/synthetic_pointer_action_params.cc ('k') | content/common/input_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698