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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_util.cc

Issue 822803005: Correct missing radius in ui::TouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup data at ui::TouchEvent level. Created 5 years, 11 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
« no previous file with comments | « no previous file | ui/events/event.h » ('j') | ui/events/event.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // radians. See: 203 // radians. See:
204 // http://developer.android.com/reference/android/view/MotionEvent.html 204 // http://developer.android.com/reference/android/view/MotionEvent.html
205 // 205 //
206 // The proposed extension to W3C Touch Events specifies the touch ellipse 206 // The proposed extension to W3C Touch Events specifies the touch ellipse
207 // using two radii along x- & y-axes and a positive acute rotation angle in 207 // using two radii along x- & y-axes and a positive acute rotation angle in
208 // degrees. See: 208 // degrees. See:
209 // http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html 209 // http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html
210 210
211 float major_radius = event.GetTouchMajor(pointer_index) / 2.f; 211 float major_radius = event.GetTouchMajor(pointer_index) / 2.f;
212 float minor_radius = event.GetTouchMinor(pointer_index) / 2.f; 212 float minor_radius = event.GetTouchMinor(pointer_index) / 2.f;
213
214 DCHECK_LE(minor_radius, major_radius);
215 DCHECK_GT(major_radius, 0);
jdduke (slow) 2015/01/13 21:08:28 I'm not sure we can assume that major_radius is no
216
213 float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI; 217 float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI;
214 DCHECK_GE(major_radius, 0); 218 DCHECK_GE(major_radius, 0);
215 DCHECK_GE(minor_radius, 0); 219 DCHECK_GE(minor_radius, 0);
216 DCHECK_GE(major_radius, minor_radius); 220 DCHECK_GE(major_radius, minor_radius);
217 // Allow a small bound tolerance to account for floating point conversion. 221 // Allow a small bound tolerance to account for floating point conversion.
218 DCHECK_GT(orientation_deg, -90.01f); 222 DCHECK_GT(orientation_deg, -90.01f);
219 DCHECK_LT(orientation_deg, 90.01f); 223 DCHECK_LT(orientation_deg, 90.01f);
220 if (orientation_deg >= 0) { 224 if (orientation_deg >= 0) {
221 // The case orientation_deg == 0 is handled here on purpose: although the 225 // The case orientation_deg == 0 is handled here on purpose: although the
222 // 'else' block is equivalent in this case, we want to pass the 0 value 226 // 'else' block is equivalent in this case, we want to pass the 0 value
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 flags |= ui::EF_CAPS_LOCK_DOWN; 457 flags |= ui::EF_CAPS_LOCK_DOWN;
454 if (modifiers & blink::WebInputEvent::IsAutoRepeat) 458 if (modifiers & blink::WebInputEvent::IsAutoRepeat)
455 flags |= ui::EF_IS_REPEAT; 459 flags |= ui::EF_IS_REPEAT;
456 if (modifiers & blink::WebInputEvent::IsKeyPad) 460 if (modifiers & blink::WebInputEvent::IsKeyPad)
457 flags |= ui::EF_NUMPAD_KEY; 461 flags |= ui::EF_NUMPAD_KEY;
458 462
459 return flags; 463 return flags;
460 } 464 }
461 465
462 } // namespace content 466 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/events/event.h » ('j') | ui/events/event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698