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

Unified Diff: content/browser/renderer_host/input/web_input_event_util.cc

Issue 531133002: Revert of Completed webkit radiusX, radiusY and rotationAngle handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/web_input_event_util.cc
diff --git a/content/browser/renderer_host/input/web_input_event_util.cc b/content/browser/renderer_host/input/web_input_event_util.cc
index 0d5ef0c0ad260c66332ef32dcf8806aabf199fd9..303a8d0844c86fa99f345dc34908ac808d600193 100644
--- a/content/browser/renderer_host/input/web_input_event_util.cc
+++ b/content/browser/renderer_host/input/web_input_event_util.cc
@@ -2,12 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// MSVC++ requires this to be set before any other includes to get M_PI.
-#define _USE_MATH_DEFINES
-
#include "content/browser/renderer_host/input/web_input_event_util.h"
-
-#include <cmath>
#include "base/strings/string_util.h"
#include "content/common/input/web_touch_event_traits.h"
@@ -193,41 +188,7 @@
touch.position.y = event.GetY(pointer_index);
touch.screenPosition.x = event.GetRawX(pointer_index);
touch.screenPosition.y = event.GetRawY(pointer_index);
-
- // A note on touch ellipse specifications:
- //
- // Android MotionEvent provides the major and minor axes of the touch ellipse,
- // as well as the orientation of the major axis clockwise from vertical, in
- // radians. See:
- // http://developer.android.com/reference/android/view/MotionEvent.html
- //
- // The proposed extension to W3C Touch Events specifies the touch ellipse
- // using two radii along x- & y-axes and a positive acute rotation angle in
- // degrees. See:
- // http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html
-
- float major_radius = event.GetTouchMajor(pointer_index) / 2.f;
- float minor_radius = event.GetTouchMinor(pointer_index) / 2.f;
- float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI;
- DCHECK_GE(major_radius, 0) << "Unexpected touch major < 0";
- DCHECK_GE(minor_radius, 0) << "Unexpected touch minor < 0";
- DCHECK_GE(major_radius, minor_radius) << "Unexpected major/minor touch radii";
- DCHECK(-90 <= orientation_deg && orientation_deg <= 90)
- << "Unexpected touch orientation angle";
- if (orientation_deg >= 0) {
- // The case orientation_deg == 0 is handled here on purpose: although the
- // 'else' block is equivalent in this case, we want to pass the 0 value
- // unchanged (and 0 is the default value for many devices that don't
- // report elliptical touches).
- touch.radiusX = minor_radius;
- touch.radiusY = major_radius;
- touch.rotationAngle = orientation_deg;
- } else {
- touch.radiusX = major_radius;
- touch.radiusY = minor_radius;
- touch.rotationAngle = orientation_deg + 90;
- }
-
+ touch.radiusX = touch.radiusY = event.GetTouchMajor(pointer_index) * 0.5f;
touch.force = event.GetPressure(pointer_index);
return touch;

Powered by Google App Engine
This is Rietveld 408576698