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

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: 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 | content/browser/renderer_host/input/web_input_event_util_unittest.cc » ('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 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 if (minor_radius == 0)
215 minor_radius = major_radius;
216 else if (major_radius == 0)
jdduke (slow) 2015/01/13 15:50:25 This shouldn't happen, should it? |major_radius| s
tdresser 2015/01/13 19:22:08 Done.
217 major_radius = minor_radius;
218
213 float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI; 219 float orientation_deg = event.GetOrientation(pointer_index) * 180.f / M_PI;
214 DCHECK_GE(major_radius, 0); 220 DCHECK_GE(major_radius, 0);
215 DCHECK_GE(minor_radius, 0); 221 DCHECK_GE(minor_radius, 0);
216 DCHECK_GE(major_radius, minor_radius); 222 DCHECK_GE(major_radius, minor_radius);
217 // Allow a small bound tolerance to account for floating point conversion. 223 // Allow a small bound tolerance to account for floating point conversion.
218 DCHECK_GT(orientation_deg, -90.01f); 224 DCHECK_GT(orientation_deg, -90.01f);
219 DCHECK_LT(orientation_deg, 90.01f); 225 DCHECK_LT(orientation_deg, 90.01f);
220 if (orientation_deg >= 0) { 226 if (orientation_deg >= 0) {
221 // The case orientation_deg == 0 is handled here on purpose: although the 227 // 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 228 // '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; 459 flags |= ui::EF_CAPS_LOCK_DOWN;
454 if (modifiers & blink::WebInputEvent::IsAutoRepeat) 460 if (modifiers & blink::WebInputEvent::IsAutoRepeat)
455 flags |= ui::EF_IS_REPEAT; 461 flags |= ui::EF_IS_REPEAT;
456 if (modifiers & blink::WebInputEvent::IsKeyPad) 462 if (modifiers & blink::WebInputEvent::IsKeyPad)
457 flags |= ui::EF_NUMPAD_KEY; 463 flags |= ui::EF_NUMPAD_KEY;
458 464
459 return flags; 465 return flags;
460 } 466 }
461 467
462 } // namespace content 468 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/web_input_event_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698