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 148453012: Chrome requires WebTouchPoint to store WebFloatPoint, instead of WebPoint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up. Created 6 years, 9 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 "ui/events/keycodes/keyboard_codes.h" 8 #include "ui/events/keycodes/keyboard_codes.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 continue; 145 continue;
146 146
147 touches[point] = touches[i]; 147 touches[point] = touches[i];
148 touches[point].state = WebTouchPoint::StateStationary; 148 touches[point].state = WebTouchPoint::StateStationary;
149 ++point; 149 ++point;
150 } 150 }
151 touchesLength = point; 151 touchesLength = point;
152 type = WebInputEvent::Undefined; 152 type = WebInputEvent::Undefined;
153 } 153 }
154 154
155 int SyntheticWebTouchEvent::PressPoint(int x, int y) { 155 int SyntheticWebTouchEvent::PressPoint(float x, float y) {
156 if (touchesLength == touchesLengthCap) 156 if (touchesLength == touchesLengthCap)
157 return -1; 157 return -1;
158 WebTouchPoint& point = touches[touchesLength]; 158 WebTouchPoint& point = touches[touchesLength];
159 point.id = touchesLength; 159 point.id = touchesLength;
160 point.position.x = point.screenPosition.x = x; 160 point.position.x = point.screenPosition.x = x;
161 point.position.y = point.screenPosition.y = y; 161 point.position.y = point.screenPosition.y = y;
162 point.state = WebTouchPoint::StatePressed; 162 point.state = WebTouchPoint::StatePressed;
163 point.radiusX = point.radiusY = 1.f; 163 point.radiusX = point.radiusY = 1.f;
164 ++touchesLength; 164 ++touchesLength;
165 type = WebInputEvent::TouchStart; 165 type = WebInputEvent::TouchStart;
166 return point.id; 166 return point.id;
167 } 167 }
168 168
169 void SyntheticWebTouchEvent::MovePoint(int index, int x, int y) { 169 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
170 CHECK(index >= 0 && index < touchesLengthCap); 170 CHECK(index >= 0 && index < touchesLengthCap);
171 WebTouchPoint& point = touches[index]; 171 WebTouchPoint& point = touches[index];
172 point.position.x = point.screenPosition.x = x; 172 point.position.x = point.screenPosition.x = x;
173 point.position.y = point.screenPosition.y = y; 173 point.position.y = point.screenPosition.y = y;
174 touches[index].state = WebTouchPoint::StateMoved; 174 touches[index].state = WebTouchPoint::StateMoved;
175 type = WebInputEvent::TouchMove; 175 type = WebInputEvent::TouchMove;
176 } 176 }
177 177
178 void SyntheticWebTouchEvent::ReleasePoint(int index) { 178 void SyntheticWebTouchEvent::ReleasePoint(int index) {
179 CHECK(index >= 0 && index < touchesLengthCap); 179 CHECK(index >= 0 && index < touchesLengthCap);
(...skipping 13 matching lines...) Expand all
193 193
194 SyntheticWebTouchEvent SyntheticWebTouchEventBuilder::Build( 194 SyntheticWebTouchEvent SyntheticWebTouchEventBuilder::Build(
195 WebInputEvent::Type type) { 195 WebInputEvent::Type type) {
196 DCHECK(WebInputEvent::isTouchEventType(type)); 196 DCHECK(WebInputEvent::isTouchEventType(type));
197 SyntheticWebTouchEvent result; 197 SyntheticWebTouchEvent result;
198 result.type = type; 198 result.type = type;
199 return result; 199 return result;
200 }; 200 };
201 201
202 } // namespace content 202 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698