| 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/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 WebMouseEvent SyntheticWebMouseEventBuilder::Build( | 22 WebMouseEvent SyntheticWebMouseEventBuilder::Build( |
| 23 blink::WebInputEvent::Type type) { | 23 blink::WebInputEvent::Type type) { |
| 24 return WebMouseEvent(type, WebInputEvent::NoModifiers, | 24 return WebMouseEvent(type, WebInputEvent::NoModifiers, |
| 25 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 25 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
| 26 } | 26 } |
| 27 | 27 |
| 28 WebMouseEvent SyntheticWebMouseEventBuilder::Build( | 28 WebMouseEvent SyntheticWebMouseEventBuilder::Build( |
| 29 blink::WebInputEvent::Type type, | 29 blink::WebInputEvent::Type type, |
| 30 int window_x, | 30 int window_x, |
| 31 int window_y, | 31 int window_y, |
| 32 int modifiers) { | 32 int modifiers, |
| 33 blink::WebPointerProperties::PointerType pointer_type) { |
| 33 DCHECK(WebInputEvent::isMouseEventType(type)); | 34 DCHECK(WebInputEvent::isMouseEventType(type)); |
| 34 WebMouseEvent result(type, modifiers, | 35 WebMouseEvent result(type, modifiers, |
| 35 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 36 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
| 36 result.x = window_x; | 37 result.x = window_x; |
| 37 result.y = window_y; | 38 result.y = window_y; |
| 38 result.windowX = window_x; | 39 result.windowX = window_x; |
| 39 result.windowY = window_y; | 40 result.windowY = window_y; |
| 40 result.setModifiers(modifiers); | 41 result.setModifiers(modifiers); |
| 41 result.pointerType = blink::WebPointerProperties::PointerType::Mouse; | 42 result.pointerType = pointer_type; |
| 42 return result; | 43 return result; |
| 43 } | 44 } |
| 44 | 45 |
| 45 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( | 46 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( |
| 46 WebMouseWheelEvent::Phase phase) { | 47 WebMouseWheelEvent::Phase phase) { |
| 47 WebMouseWheelEvent result(WebInputEvent::MouseWheel, | 48 WebMouseWheelEvent result(WebInputEvent::MouseWheel, |
| 48 WebInputEvent::NoModifiers, | 49 WebInputEvent::NoModifiers, |
| 49 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); | 50 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
| 50 result.phase = phase; | 51 result.phase = phase; |
| 51 return result; | 52 return result; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 246 |
| 246 int SyntheticWebTouchEvent::FirstFreeIndex() { | 247 int SyntheticWebTouchEvent::FirstFreeIndex() { |
| 247 for (size_t i = 0; i < kTouchesLengthCap; ++i) { | 248 for (size_t i = 0; i < kTouchesLengthCap; ++i) { |
| 248 if (touches[i].state == WebTouchPoint::StateUndefined) | 249 if (touches[i].state == WebTouchPoint::StateUndefined) |
| 249 return i; | 250 return i; |
| 250 } | 251 } |
| 251 return -1; | 252 return -1; |
| 252 } | 253 } |
| 253 | 254 |
| 254 } // namespace content | 255 } // namespace content |
| OLD | NEW |