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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_mac.mm

Issue 2361523002: Pressure should not be set when the pointer device doesn't support pressure (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/web_input_event_builders_mac.mm
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
index d9cf15370d0d376278a578286087fb56a0d673a0..45c37416b0d02e754e0700ceaed613b8fbff8bc2 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm
+++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -405,17 +405,22 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) {
// For other mouse events and touchpad events, the pointer type is mouse.
// For all other tablet events, the pointer type will be just pen.
NSEventSubtype subtype = [event subtype];
- if (subtype == NSTabletPointEventSubtype ||
- subtype == NSTabletProximityEventSubtype) {
- result.pointerType = blink::WebPointerProperties::PointerType::Pen;
- } else {
+ if (subtype != NSTabletPointEventSubtype &&
+ subtype != NSTabletProximityEventSubtype) {
result.pointerType = blink::WebPointerProperties::PointerType::Mouse;
+ return result;
mustaq 2016/09/21 19:39:36 - Could you please confirm that uninitialized resu
lanwei 2016/09/21 20:13:42 Yes, default values of force is NaN, tiltx, y are
}
+
+ // Set stylus properties for events with a subtype of
+ // NSTabletPointEventSubtype.
+ result.pointerType = blink::WebPointerProperties::PointerType::Pen;
result.id = [event deviceID];
- result.force = [event pressure];
- NSPoint tilt = [event tilt];
- result.tiltX = lround(tilt.x * 90);
- result.tiltY = lround(tilt.y * 90);
+ if (subtype == NSTabletPointEventSubtype) {
+ result.force = [event pressure];
+ NSPoint tilt = [event tilt];
+ result.tiltX = lround(tilt.x * 90);
+ result.tiltY = lround(tilt.y * 90);
+ }
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698