Chromium Code Reviews| 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; |
| 41 result.pointerType = pointer_type; | |
|
Navid Zolghadr
2017/01/19 15:46:22
Do we expect this to be only mouse and pen? Do you
lanwei
2017/01/20 14:42:21
Done.
| |
| 40 | 42 |
| 41 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) | 43 if (type == WebInputEvent::MouseDown || type == WebInputEvent::MouseUp) |
| 42 result.button = WebMouseEvent::Button::Left; | 44 result.button = WebMouseEvent::Button::Left; |
| 43 else | 45 else |
| 44 result.button = WebMouseEvent::Button::NoButton; | 46 result.button = WebMouseEvent::Button::NoButton; |
| 45 | 47 |
| 46 return result; | 48 return result; |
| 47 } | 49 } |
| 48 | 50 |
| 49 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( | 51 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 | 251 |
| 250 int SyntheticWebTouchEvent::FirstFreeIndex() { | 252 int SyntheticWebTouchEvent::FirstFreeIndex() { |
| 251 for (size_t i = 0; i < kTouchesLengthCap; ++i) { | 253 for (size_t i = 0; i < kTouchesLengthCap; ++i) { |
| 252 if (touches[i].state == WebTouchPoint::StateUndefined) | 254 if (touches[i].state == WebTouchPoint::StateUndefined) |
| 253 return i; | 255 return i; |
| 254 } | 256 } |
| 255 return -1; | 257 return -1; |
| 256 } | 258 } |
| 257 | 259 |
| 258 } // namespace content | 260 } // namespace content |
| OLD | NEW |