OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/renderer_host/input/synthetic_mouse_driver.h" | 5 #include "content/browser/renderer_host/input/synthetic_mouse_driver.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 SyntheticMouseDriver::SyntheticMouseDriver() : last_modifiers_(0) { | 11 SyntheticMouseDriver::SyntheticMouseDriver() : last_modifiers_(0) { |
12 mouse_event_.pointer_type = blink::WebPointerProperties::PointerType::kMouse; | 12 mouse_event_.pointer_type = blink::WebPointerProperties::PointerType::kMouse; |
13 } | 13 } |
14 | 14 |
15 SyntheticMouseDriver::~SyntheticMouseDriver() {} | 15 SyntheticMouseDriver::~SyntheticMouseDriver() {} |
16 | 16 |
17 void SyntheticMouseDriver::DispatchEvent(SyntheticGestureTarget* target, | 17 void SyntheticMouseDriver::DispatchEvent(SyntheticGestureTarget* target, |
18 const base::TimeTicks& timestamp) { | 18 const base::TimeTicks& timestamp) { |
19 mouse_event_.SetTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); | 19 mouse_event_.SetTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); |
20 target->DispatchInputEventToPlatform(mouse_event_); | 20 if (mouse_event_.GetType() != blink::WebInputEvent::kUndefined) { |
| 21 target->DispatchInputEventToPlatform(mouse_event_); |
| 22 mouse_event_.SetType(blink::WebInputEvent::kUndefined); |
| 23 } |
21 } | 24 } |
22 | 25 |
23 void SyntheticMouseDriver::Press(float x, | 26 void SyntheticMouseDriver::Press(float x, |
24 float y, | 27 float y, |
25 int index, | 28 int index, |
26 SyntheticPointerActionParams::Button button) { | 29 SyntheticPointerActionParams::Button button) { |
27 DCHECK_EQ(index, 0); | 30 DCHECK_EQ(index, 0); |
28 int modifiers = | 31 int modifiers = |
29 SyntheticPointerActionParams::GetWebMouseEventModifier(button); | 32 SyntheticPointerActionParams::GetWebMouseEventModifier(button); |
30 mouse_event_ = SyntheticWebMouseEventBuilder::Build( | 33 mouse_event_ = SyntheticWebMouseEventBuilder::Build( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (params.pointer_action_type() == | 87 if (params.pointer_action_type() == |
85 SyntheticPointerActionParams::PointerActionType::RELEASE && | 88 SyntheticPointerActionParams::PointerActionType::RELEASE && |
86 mouse_event_.click_count <= 0) { | 89 mouse_event_.click_count <= 0) { |
87 return false; | 90 return false; |
88 } | 91 } |
89 | 92 |
90 return true; | 93 return true; |
91 } | 94 } |
92 | 95 |
93 } // namespace content | 96 } // namespace content |
OLD | NEW |