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); | |
Navid Zolghadr
2017/05/17 16:30:10
We set the type to kUndefined again if it is alrea
lanwei
2017/05/19 15:04:57
Done.
| |
21 } | 23 } |
22 | 24 |
23 void SyntheticMouseDriver::Press(float x, | 25 void SyntheticMouseDriver::Press(float x, |
24 float y, | 26 float y, |
25 int index, | 27 int index, |
26 SyntheticPointerActionParams::Button button) { | 28 SyntheticPointerActionParams::Button button) { |
27 DCHECK_EQ(index, 0); | 29 DCHECK_EQ(index, 0); |
28 int modifiers = | 30 int modifiers = |
29 SyntheticPointerActionParams::GetWebMouseEventModifier(button); | 31 SyntheticPointerActionParams::GetWebMouseEventModifier(button); |
30 mouse_event_ = SyntheticWebMouseEventBuilder::Build( | 32 mouse_event_ = SyntheticWebMouseEventBuilder::Build( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 if (params.pointer_action_type() == | 86 if (params.pointer_action_type() == |
85 SyntheticPointerActionParams::PointerActionType::RELEASE && | 87 SyntheticPointerActionParams::PointerActionType::RELEASE && |
86 mouse_event_.click_count <= 0) { | 88 mouse_event_.click_count <= 0) { |
87 return false; | 89 return false; |
88 } | 90 } |
89 | 91 |
90 return true; | 92 return true; |
91 } | 93 } |
92 | 94 |
93 } // namespace content | 95 } // namespace content |
OLD | NEW |