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

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

Issue 10383249: touch: Make sure the correct radius values are used for touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: non-zero-scale Created 8 years, 7 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
« no previous file with comments | « no previous file | ui/aura/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Portions based heavily on: 5 // Portions based heavily on:
6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp 6 // third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.cpp
7 // 7 //
8 /* 8 /*
9 * Copyright (C) 2006-2011 Google Inc. All rights reserved. 9 * Copyright (C) 2006-2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 break; 403 break;
404 } 404 }
405 default: 405 default:
406 DLOG(WARNING) << "Unknown touch event " << event->type(); 406 DLOG(WARNING) << "Unknown touch event " << event->type();
407 break; 407 break;
408 } 408 }
409 409
410 if (!point) 410 if (!point)
411 return NULL; 411 return NULL;
412 412
413 point->radiusX = event->radius_x(); 413 // The spec requires the radii values to be positive (and 1 when unknown).
414 point->radiusY = event->radius_y(); 414 point->radiusX = std::max(1.f, event->radius_x());
415 point->radiusY = std::max(1.f, event->radius_y());
415 point->rotationAngle = event->rotation_angle(); 416 point->rotationAngle = event->rotation_angle();
416 point->force = event->force(); 417 point->force = event->force();
417 418
418 // Update the location and state of the point. 419 // Update the location and state of the point.
419 point->state = TouchPointStateFromEvent(event); 420 point->state = TouchPointStateFromEvent(event);
420 if (point->state == WebKit::WebTouchPoint::StateMoved) { 421 if (point->state == WebKit::WebTouchPoint::StateMoved) {
421 // It is possible for badly written touch drivers to emit Move events even 422 // It is possible for badly written touch drivers to emit Move events even
422 // when the touch location hasn't changed. In such cases, consume the event 423 // when the touch location hasn't changed. In such cases, consume the event
423 // and pretend nothing happened. 424 // and pretend nothing happened.
424 if (point->position.x == event->x() && point->position.y == event->y()) 425 if (point->position.x == event->x() && point->position.y == event->y())
(...skipping 15 matching lines...) Expand all
440 441
441 // Update the type of the touch event. 442 // Update the type of the touch event.
442 web_event->type = TouchEventTypeFromEvent(event); 443 web_event->type = TouchEventTypeFromEvent(event);
443 web_event->timeStampSeconds = event->time_stamp().InSecondsF(); 444 web_event->timeStampSeconds = event->time_stamp().InSecondsF();
444 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags()); 445 web_event->modifiers = EventFlagsToWebEventModifiers(event->flags());
445 446
446 return point; 447 return point;
447 } 448 }
448 449
449 } // namespace content 450 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/aura/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698