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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.cc

Issue 2633233002: Add the pointer type of pen to the synthetic WebMousEvent (Closed)
Patch Set: pen type Created 3 years, 11 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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698