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

Side by Side Diff: content/browser/renderer_host/ui_events_helper.cc

Issue 393953012: Eager Gesture Recognition on Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor based on Jared's comments. Created 6 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui_events_helper.h" 5 #include "content/browser/renderer_host/ui_events_helper.h"
6 6
7 #include "content/common/input/web_touch_event_traits.h" 7 #include "content/common/input/web_touch_event_traits.h"
8 #include "third_party/WebKit/public/web/WebInputEvent.h" 8 #include "third_party/WebKit/public/web/WebInputEvent.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 return NULL; 299 return NULL;
300 300
301 // The spec requires the radii values to be positive (and 1 when unknown). 301 // The spec requires the radii values to be positive (and 1 when unknown).
302 point->radiusX = std::max(1.f, event.radius_x()); 302 point->radiusX = std::max(1.f, event.radius_x());
303 point->radiusY = std::max(1.f, event.radius_y()); 303 point->radiusY = std::max(1.f, event.radius_y());
304 point->rotationAngle = event.rotation_angle(); 304 point->rotationAngle = event.rotation_angle();
305 point->force = event.force(); 305 point->force = event.force();
306 306
307 // Update the location and state of the point. 307 // Update the location and state of the point.
308 point->state = TouchPointStateFromEvent(event); 308 point->state = TouchPointStateFromEvent(event);
309 if (point->state == blink::WebTouchPoint::StateMoved) {
310 // It is possible for badly written touch drivers to emit Move events even
311 // when the touch location hasn't changed. In such cases, consume the event
312 // and pretend nothing happened.
313 if (point->position.x == event.x() && point->position.y == event.y())
314 return NULL;
315 }
316 point->position.x = event.x(); 309 point->position.x = event.x();
317 point->position.y = event.y(); 310 point->position.y = event.y();
318 311
319 const gfx::PointF& root_point = event.root_location_f(); 312 const gfx::PointF& root_point = event.root_location_f();
320 point->screenPosition.x = root_point.x(); 313 point->screenPosition.x = root_point.x();
321 point->screenPosition.y = root_point.y(); 314 point->screenPosition.y = root_point.y();
322 315
323 // Mark the rest of the points as stationary. 316 // Mark the rest of the points as stationary.
324 for (unsigned i = 0; i < web_event->touchesLength; ++i) { 317 for (unsigned i = 0; i < web_event->touchesLength; ++i) {
325 blink::WebTouchPoint* iter = web_event->touches + i; 318 blink::WebTouchPoint* iter = web_event->touches + i;
326 if (iter != point) 319 if (iter != point)
327 iter->state = blink::WebTouchPoint::StateStationary; 320 iter->state = blink::WebTouchPoint::StateStationary;
328 } 321 }
329 322
330 // Update the type of the touch event. 323 // Update the type of the touch event.
331 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), 324 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event),
332 event.time_stamp().InSecondsF(), 325 event.time_stamp().InSecondsF(),
333 web_event); 326 web_event);
334 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); 327 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags());
335 328
336 return point; 329 return point;
337 } 330 }
338 331
339 } // namespace content 332 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698