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

Side by Side Diff: Source/web/WebInputEventConversion.cpp

Issue 1192563002: Pass real tilt information to PointerEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 // This assumes convertFromContainingWindow does only translations, not scal es. 423 // This assumes convertFromContainingWindow does only translations, not scal es.
424 FloatPoint floatPos = convertHitPointToWindow(widget, point.position); 424 FloatPoint floatPos = convertHitPointToWindow(widget, point.position);
425 IntPoint flooredPoint = flooredIntPoint(floatPos); 425 IntPoint flooredPoint = flooredIntPoint(floatPos);
426 m_pos = widget->convertFromContainingWindow(flooredPoint) + (floatPos - floo redPoint); 426 m_pos = widget->convertFromContainingWindow(flooredPoint) + (floatPos - floo redPoint);
427 427
428 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); 428 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y);
429 m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY) ); 429 m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY) );
430 m_rotationAngle = point.rotationAngle; 430 m_rotationAngle = point.rotationAngle;
431 m_force = point.force; 431 m_force = point.force;
432 // TODO(e_hakkinen): Leave only either tilt and tiltOrientation, tiltRad and
433 // tiltOrientationRad or tiltX and tiltY.
434 if (point.tilt) {
mustaq 2015/06/17 19:43:28 Yes, representing the 3D tilt with two dedicated s
USE eero AT chromium.org 2015/06/18 11:34:08 Done.
435 float tiltOrientationRad = point.tiltOrientation * M_PI / 180.f;
436 float tiltRad = point.tilt * M_PI / 180.f;
437 float r = sin(tiltRad);
438 float z = cos(tiltRad);
439 m_tilt = FloatPoint(
440 atan2(sin(tiltOrientationRad) * r, z) * 180.f / M_PI,
441 atan2(-cos(tiltOrientationRad) * r, z) * 180.f / M_PI);
442 } else {
443 m_tilt = FloatPoint(0, 0);
444 }
445 if (point.tiltRad) {
446 float r = sin(point.tiltRad);
447 float z = cos(point.tiltRad);
448 m_tilt = FloatPoint(
449 atan2(sin(point.tiltOrientationRad) * r, z) * 180.f / M_PI,
450 atan2(-cos(point.tiltOrientationRad) * r, z) * 180.f / M_PI);
451 } else {
452 m_tilt = FloatPoint(0, 0);
453 }
454 m_tilt = FloatPoint(point.tiltX, point.tiltY);
432 } 455 }
433 456
434 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo uchEvent& event) 457 PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTo uchEvent& event)
435 { 458 {
436 m_type = toPlatformTouchEventType(event.type); 459 m_type = toPlatformTouchEventType(event.type);
437 m_modifiers = toPlatformEventModifiers(event.modifiers); 460 m_modifiers = toPlatformEventModifiers(event.modifiers);
438 m_timestamp = event.timeStampSeconds; 461 m_timestamp = event.timeStampSeconds;
439 m_causesScrollingIfUncanceled = event.causesScrollingIfUncanceled; 462 m_causesScrollingIfUncanceled = event.causesScrollingIfUncanceled;
440 463
441 for (unsigned i = 0; i < event.touchesLength; ++i) 464 for (unsigned i = 0; i < event.touchesLength; ++i)
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 modifiers = getWebInputModifiers(event); 775 modifiers = getWebInputModifiers(event);
753 776
754 globalX = event.screenX(); 777 globalX = event.screenX();
755 globalY = event.screenY(); 778 globalY = event.screenY();
756 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject); 779 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject);
757 x = localPoint.x(); 780 x = localPoint.x();
758 y = localPoint.y(); 781 y = localPoint.y();
759 } 782 }
760 783
761 } // namespace blink 784 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698