| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /* | 5 /* |
| 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2006-2009 Google Inc. | 7 * Copyright (C) 2006-2009 Google Inc. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 // Set stylus properties for events with a subtype of | 338 // Set stylus properties for events with a subtype of |
| 339 // NSTabletPointEventSubtype. | 339 // NSTabletPointEventSubtype. |
| 340 result.pointerType = blink::WebPointerProperties::PointerType::Pen; | 340 result.pointerType = blink::WebPointerProperties::PointerType::Pen; |
| 341 result.id = [event deviceID]; | 341 result.id = [event deviceID]; |
| 342 if (subtype == NSTabletPointEventSubtype) { | 342 if (subtype == NSTabletPointEventSubtype) { |
| 343 result.force = [event pressure]; | 343 result.force = [event pressure]; |
| 344 NSPoint tilt = [event tilt]; | 344 NSPoint tilt = [event tilt]; |
| 345 result.tiltX = lround(tilt.x * 90); | 345 result.tiltX = lround(tilt.x * 90); |
| 346 result.tiltY = lround(tilt.y * 90); | 346 result.tiltY = lround(tilt.y * 90); |
| 347 result.tangentialPressure = [event tangentialPressure]; |
| 348 // NSEvent spec doesn't specify the range of rotation, we make sure that |
| 349 // this value is in the range of [0,359]. |
| 350 int twist = (int)[event rotation]; |
| 351 twist = twist % 360; |
| 352 if (twist < 0) |
| 353 twist += 360; |
| 354 result.twist = twist; |
| 347 } | 355 } |
| 348 return result; | 356 return result; |
| 349 } | 357 } |
| 350 | 358 |
| 351 // WebMouseWheelEvent --------------------------------------------------------- | 359 // WebMouseWheelEvent --------------------------------------------------------- |
| 352 | 360 |
| 353 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( | 361 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( |
| 354 NSEvent* event, | 362 NSEvent* event, |
| 355 NSView* view) { | 363 NSView* view) { |
| 356 blink::WebMouseWheelEvent result(blink::WebInputEvent::MouseWheel, | 364 blink::WebMouseWheelEvent result(blink::WebInputEvent::MouseWheel, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // to specify them when the gesture is differentiated. | 541 // to specify them when the gesture is differentiated. |
| 534 break; | 542 break; |
| 535 default: | 543 default: |
| 536 NOTIMPLEMENTED(); | 544 NOTIMPLEMENTED(); |
| 537 } | 545 } |
| 538 | 546 |
| 539 return result; | 547 return result; |
| 540 } | 548 } |
| 541 | 549 |
| 542 } // namespace content | 550 } // namespace content |
| OLD | NEW |