Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: content/browser/renderer_host/input/synthetic_mouse_driver.cc

Issue 2807433003: No pointer captured when the pointer lock is applied (Closed)
Patch Set: Merge tests and rename functions Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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);
dtapuska 2017/05/29 20:57:40 Can we avoid the calls to SetType() and just mouse
lanwei 2017/05/30 17:11:36 We still need other states, like button, click cou
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698