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

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

Issue 304793003: use enum to specify deviceSource for fling animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased for parallel breaking changes Created 6 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 | Annotate | Revision Log
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/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 WebInputEvent::Type type) { 75 WebInputEvent::Type type) {
76 DCHECK(WebInputEvent::isKeyboardEventType(type)); 76 DCHECK(WebInputEvent::isKeyboardEventType(type));
77 WebKeyboardEvent result; 77 WebKeyboardEvent result;
78 result.type = type; 78 result.type = type;
79 result.windowsKeyCode = ui::VKEY_L; // non-null made up value. 79 result.windowsKeyCode = ui::VKEY_L; // non-null made up value.
80 return result; 80 return result;
81 } 81 }
82 82
83 WebGestureEvent SyntheticWebGestureEventBuilder::Build( 83 WebGestureEvent SyntheticWebGestureEventBuilder::Build(
84 WebInputEvent::Type type, 84 WebInputEvent::Type type,
85 WebGestureEvent::SourceDevice source_device) { 85 blink::WebGestureDevice source_device) {
86 DCHECK(WebInputEvent::isGestureEventType(type)); 86 DCHECK(WebInputEvent::isGestureEventType(type));
87 WebGestureEvent result; 87 WebGestureEvent result;
88 result.type = type; 88 result.type = type;
89 result.sourceDevice = source_device; 89 result.sourceDevice = source_device;
90 if (type == WebInputEvent::GestureTap || 90 if (type == WebInputEvent::GestureTap ||
91 type == WebInputEvent::GestureTapUnconfirmed || 91 type == WebInputEvent::GestureTapUnconfirmed ||
92 type == WebInputEvent::GestureDoubleTap) { 92 type == WebInputEvent::GestureDoubleTap) {
93 result.data.tap.tapCount = 1; 93 result.data.tap.tapCount = 1;
94 result.data.tap.width = 10; 94 result.data.tap.width = 10;
95 result.data.tap.height = 10; 95 result.data.tap.height = 10;
96 } 96 }
97 return result; 97 return result;
98 } 98 }
99 99
100 WebGestureEvent SyntheticWebGestureEventBuilder::BuildScrollBegin( 100 WebGestureEvent SyntheticWebGestureEventBuilder::BuildScrollBegin(
101 float dx_hint, 101 float dx_hint,
102 float dy_hint) { 102 float dy_hint) {
103 WebGestureEvent result = Build(WebInputEvent::GestureScrollBegin, 103 WebGestureEvent result = Build(WebInputEvent::GestureScrollBegin,
104 WebGestureEvent::Touchscreen); 104 blink::WebGestureDeviceTouchscreen);
105 result.data.scrollBegin.deltaXHint = dx_hint; 105 result.data.scrollBegin.deltaXHint = dx_hint;
106 result.data.scrollBegin.deltaYHint = dy_hint; 106 result.data.scrollBegin.deltaYHint = dy_hint;
107 return result; 107 return result;
108 } 108 }
109 109
110 WebGestureEvent SyntheticWebGestureEventBuilder::BuildScrollUpdate( 110 WebGestureEvent SyntheticWebGestureEventBuilder::BuildScrollUpdate(
111 float dx, 111 float dx,
112 float dy, 112 float dy,
113 int modifiers) { 113 int modifiers) {
114 WebGestureEvent result = Build(WebInputEvent::GestureScrollUpdate, 114 WebGestureEvent result = Build(WebInputEvent::GestureScrollUpdate,
115 WebGestureEvent::Touchscreen); 115 blink::WebGestureDeviceTouchscreen);
116 result.data.scrollUpdate.deltaX = dx; 116 result.data.scrollUpdate.deltaX = dx;
117 result.data.scrollUpdate.deltaY = dy; 117 result.data.scrollUpdate.deltaY = dy;
118 result.modifiers = modifiers; 118 result.modifiers = modifiers;
119 return result; 119 return result;
120 } 120 }
121 121
122 WebGestureEvent SyntheticWebGestureEventBuilder::BuildPinchUpdate( 122 WebGestureEvent SyntheticWebGestureEventBuilder::BuildPinchUpdate(
123 float scale, 123 float scale,
124 float anchor_x, 124 float anchor_x,
125 float anchor_y, 125 float anchor_y,
126 int modifiers, 126 int modifiers,
127 WebGestureEvent::SourceDevice source_device) { 127 blink::WebGestureDevice source_device) {
128 WebGestureEvent result = 128 WebGestureEvent result =
129 Build(WebInputEvent::GesturePinchUpdate, source_device); 129 Build(WebInputEvent::GesturePinchUpdate, source_device);
130 result.data.pinchUpdate.scale = scale; 130 result.data.pinchUpdate.scale = scale;
131 result.x = anchor_x; 131 result.x = anchor_x;
132 result.y = anchor_y; 132 result.y = anchor_y;
133 result.globalX = anchor_x; 133 result.globalX = anchor_x;
134 result.globalY = anchor_y; 134 result.globalY = anchor_y;
135 result.modifiers = modifiers; 135 result.modifiers = modifiers;
136 return result; 136 return result;
137 } 137 }
138 138
139 WebGestureEvent SyntheticWebGestureEventBuilder::BuildFling( 139 WebGestureEvent SyntheticWebGestureEventBuilder::BuildFling(
140 float velocity_x, 140 float velocity_x,
141 float velocity_y, 141 float velocity_y,
142 WebGestureEvent::SourceDevice source_device) { 142 blink::WebGestureDevice source_device) {
143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, 143 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart,
144 source_device); 144 source_device);
145 result.data.flingStart.velocityX = velocity_x; 145 result.data.flingStart.velocityX = velocity_x;
146 result.data.flingStart.velocityY = velocity_y; 146 result.data.flingStart.velocityY = velocity_y;
147 return result; 147 return result;
148 } 148 }
149 149
150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { 150 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {
151 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); 151 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks());
152 } 152 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 touches[index].state = WebTouchPoint::StateCancelled; 202 touches[index].state = WebTouchPoint::StateCancelled;
203 WebTouchEventTraits::ResetType( 203 WebTouchEventTraits::ResetType(
204 WebInputEvent::TouchCancel, timeStampSeconds, this); 204 WebInputEvent::TouchCancel, timeStampSeconds, this);
205 } 205 }
206 206
207 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 207 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
208 timeStampSeconds = timestamp.InSecondsF(); 208 timeStampSeconds = timestamp.InSecondsF();
209 } 209 }
210 210
211 } // namespace content 211 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/synthetic_web_input_event_builders.h ('k') | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698