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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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/event.h" 10 #include "ui/events/event.h"
(...skipping 17 matching lines...) Expand all
28 28
29 WebMouseEvent SyntheticWebMouseEventBuilder::Build( 29 WebMouseEvent SyntheticWebMouseEventBuilder::Build(
30 blink::WebInputEvent::Type type, 30 blink::WebInputEvent::Type type,
31 int window_x, 31 int window_x,
32 int window_y, 32 int window_y,
33 int modifiers, 33 int modifiers,
34 blink::WebPointerProperties::PointerType pointer_type) { 34 blink::WebPointerProperties::PointerType pointer_type) {
35 DCHECK(WebInputEvent::isMouseEventType(type)); 35 DCHECK(WebInputEvent::isMouseEventType(type));
36 WebMouseEvent result(type, modifiers, 36 WebMouseEvent result(type, modifiers,
37 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 37 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
38 result.x = window_x; 38 result.setPositionInWidget(window_x, window_y);
39 result.y = window_y;
40 result.setModifiers(modifiers); 39 result.setModifiers(modifiers);
41 result.pointerType = pointer_type; 40 result.pointerType = pointer_type;
42 result.id = ui::PointerEvent::kMousePointerId; 41 result.id = ui::PointerEvent::kMousePointerId;
43 return result; 42 return result;
44 } 43 }
45 44
46 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build( 45 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(
47 WebMouseWheelEvent::Phase phase) { 46 WebMouseWheelEvent::Phase phase) {
48 WebMouseWheelEvent result(WebInputEvent::MouseWheel, 47 WebMouseWheelEvent result(WebInputEvent::MouseWheel,
49 WebInputEvent::NoModifiers, 48 WebInputEvent::NoModifiers,
(...skipping 14 matching lines...) Expand all
64 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x, 63 WebMouseWheelEvent SyntheticWebMouseWheelEventBuilder::Build(float x,
65 float y, 64 float y,
66 float global_x, 65 float global_x,
67 float global_y, 66 float global_y,
68 float dx, 67 float dx,
69 float dy, 68 float dy,
70 int modifiers, 69 int modifiers,
71 bool precise) { 70 bool precise) {
72 WebMouseWheelEvent result(WebInputEvent::MouseWheel, modifiers, 71 WebMouseWheelEvent result(WebInputEvent::MouseWheel, modifiers,
73 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); 72 ui::EventTimeStampToSeconds(ui::EventTimeForNow()));
74 result.globalX = global_x; 73 result.setPositionInScreen(global_x, global_y);
75 result.globalY = global_y; 74 result.setPositionInWidget(x, y);
76 result.x = x;
77 result.y = y;
78 result.deltaX = dx; 75 result.deltaX = dx;
79 result.deltaY = dy; 76 result.deltaY = dy;
80 if (dx) 77 if (dx)
81 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f; 78 result.wheelTicksX = dx > 0.0f ? 1.0f : -1.0f;
82 if (dy) 79 if (dy)
83 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f; 80 result.wheelTicksY = dy > 0.0f ? 1.0f : -1.0f;
84 result.hasPreciseScrollingDeltas = precise; 81 result.hasPreciseScrollingDeltas = precise;
85 return result; 82 return result;
86 } 83 }
87 84
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 246
250 int SyntheticWebTouchEvent::FirstFreeIndex() { 247 int SyntheticWebTouchEvent::FirstFreeIndex() {
251 for (size_t i = 0; i < kTouchesLengthCap; ++i) { 248 for (size_t i = 0; i < kTouchesLengthCap; ++i) {
252 if (touches[i].state == WebTouchPoint::StateUndefined) 249 if (touches[i].state == WebTouchPoint::StateUndefined)
253 return i; 250 return i;
254 } 251 }
255 return -1; 252 return -1;
256 } 253 }
257 254
258 } // namespace content 255 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/input_param_traits_unittest.cc ('k') | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698