OLD | NEW |
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/event.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 11 #include "ui/events/keycodes/keyboard_codes.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 using blink::WebInputEvent; | 15 using blink::WebInputEvent; |
15 using blink::WebKeyboardEvent; | 16 using blink::WebKeyboardEvent; |
16 using blink::WebGestureEvent; | 17 using blink::WebGestureEvent; |
17 using blink::WebMouseEvent; | 18 using blink::WebMouseEvent; |
18 using blink::WebMouseWheelEvent; | 19 using blink::WebMouseWheelEvent; |
19 using blink::WebTouchEvent; | 20 using blink::WebTouchEvent; |
(...skipping 13 matching lines...) Expand all Loading... |
33 blink::WebPointerProperties::PointerType pointer_type) { | 34 blink::WebPointerProperties::PointerType pointer_type) { |
34 DCHECK(WebInputEvent::isMouseEventType(type)); | 35 DCHECK(WebInputEvent::isMouseEventType(type)); |
35 WebMouseEvent result(type, modifiers, | 36 WebMouseEvent result(type, modifiers, |
36 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 37 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
37 result.x = window_x; | 38 result.x = window_x; |
38 result.y = window_y; | 39 result.y = window_y; |
39 result.windowX = window_x; | 40 result.windowX = window_x; |
40 result.windowY = window_y; | 41 result.windowY = window_y; |
41 result.setModifiers(modifiers); | 42 result.setModifiers(modifiers); |
42 result.pointerType = pointer_type; | 43 result.pointerType = pointer_type; |
| 44 result.id = ui::PointerEvent::kMousePointerId; |
43 return result; | 45 return result; |
44 } | 46 } |
45 | 47 |
46 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( | 48 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( |
47 WebMouseWheelEvent::Phase phase) { | 49 WebMouseWheelEvent::Phase phase) { |
48 WebMouseWheelEvent result(WebInputEvent::MouseWheel, | 50 WebMouseWheelEvent result(WebInputEvent::MouseWheel, |
49 WebInputEvent::NoModifiers, | 51 WebInputEvent::NoModifiers, |
50 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 52 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
51 result.phase = phase; | 53 result.phase = phase; |
52 return result; | 54 return result; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 248 |
247 int SyntheticWebTouchEvent::FirstFreeIndex() { | 249 int SyntheticWebTouchEvent::FirstFreeIndex() { |
248 for (size_t i = 0; i < kTouchesLengthCap; ++i) { | 250 for (size_t i = 0; i < kTouchesLengthCap; ++i) { |
249 if (touches[i].state == WebTouchPoint::StateUndefined) | 251 if (touches[i].state == WebTouchPoint::StateUndefined) |
250 return i; | 252 return i; |
251 } | 253 } |
252 return -1; | 254 return -1; |
253 } | 255 } |
254 | 256 |
255 } // namespace content | 257 } // namespace content |
OLD | NEW |