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 // 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 "ui/events/blink/blink_event_util.h" | 8 #include "ui/events/blink/blink_event_util.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 WebTouchPoint CreateWebTouchPoint(const MotionEvent& event, | 87 WebTouchPoint CreateWebTouchPoint(const MotionEvent& event, |
88 size_t pointer_index) { | 88 size_t pointer_index) { |
89 WebTouchPoint touch; | 89 WebTouchPoint touch; |
90 touch.id = event.GetPointerId(pointer_index); | 90 touch.id = event.GetPointerId(pointer_index); |
91 touch.pointerType = ToWebPointerType(event.GetToolType(pointer_index)); | 91 touch.pointerType = ToWebPointerType(event.GetToolType(pointer_index)); |
92 touch.state = ToWebTouchPointState(event, pointer_index); | 92 touch.state = ToWebTouchPointState(event, pointer_index); |
93 touch.position.x = event.GetX(pointer_index); | 93 touch.position.x = event.GetX(pointer_index); |
94 touch.position.y = event.GetY(pointer_index); | 94 touch.position.y = event.GetY(pointer_index); |
95 touch.screenPosition.x = event.GetRawX(pointer_index); | 95 touch.screenPosition.x = event.GetRawX(pointer_index); |
96 touch.screenPosition.y = event.GetRawY(pointer_index); | 96 touch.screenPosition.y = event.GetRawY(pointer_index); |
| 97 LOG(ERROR) << "CreateWebTouchPoint. Pointer: " << static_cast<int>(touch.point
erType); |
97 | 98 |
98 // A note on touch ellipse specifications: | 99 // A note on touch ellipse specifications: |
99 // | 100 // |
100 // Android MotionEvent provides the major and minor axes of the touch ellipse, | 101 // Android MotionEvent provides the major and minor axes of the touch ellipse, |
101 // as well as the orientation of the major axis clockwise from vertical, in | 102 // as well as the orientation of the major axis clockwise from vertical, in |
102 // radians. See: | 103 // radians. See: |
103 // http://developer.android.com/reference/android/view/MotionEvent.html | 104 // http://developer.android.com/reference/android/view/MotionEvent.html |
104 // | 105 // |
105 // The proposed extension to W3C Touch Events specifies the touch ellipse | 106 // The proposed extension to W3C Touch Events specifies the touch ellipse |
106 // using two radii along x- & y-axes and a positive acute rotation angle in | 107 // using two radii along x- & y-axes and a positive acute rotation angle in |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 switch (tool_type) { | 469 switch (tool_type) { |
469 case MotionEvent::TOOL_TYPE_UNKNOWN: | 470 case MotionEvent::TOOL_TYPE_UNKNOWN: |
470 return WebPointerProperties::PointerType::Unknown; | 471 return WebPointerProperties::PointerType::Unknown; |
471 case MotionEvent::TOOL_TYPE_FINGER: | 472 case MotionEvent::TOOL_TYPE_FINGER: |
472 return WebPointerProperties::PointerType::Touch; | 473 return WebPointerProperties::PointerType::Touch; |
473 case MotionEvent::TOOL_TYPE_STYLUS: | 474 case MotionEvent::TOOL_TYPE_STYLUS: |
474 return WebPointerProperties::PointerType::Pen; | 475 return WebPointerProperties::PointerType::Pen; |
475 case MotionEvent::TOOL_TYPE_MOUSE: | 476 case MotionEvent::TOOL_TYPE_MOUSE: |
476 return WebPointerProperties::PointerType::Mouse; | 477 return WebPointerProperties::PointerType::Mouse; |
477 case MotionEvent::TOOL_TYPE_ERASER: | 478 case MotionEvent::TOOL_TYPE_ERASER: |
478 return WebPointerProperties::PointerType::Unknown; | 479 return WebPointerProperties::PointerType::Eraser; |
479 } | 480 } |
480 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type; | 481 NOTREACHED() << "Invalid MotionEvent::ToolType = " << tool_type; |
481 return WebPointerProperties::PointerType::Unknown; | 482 return WebPointerProperties::PointerType::Unknown; |
482 } | 483 } |
483 | 484 |
484 int WebEventModifiersToEventFlags(int modifiers) { | 485 int WebEventModifiersToEventFlags(int modifiers) { |
485 int flags = 0; | 486 int flags = 0; |
486 | 487 |
487 if (modifiers & blink::WebInputEvent::ShiftKey) | 488 if (modifiers & blink::WebInputEvent::ShiftKey) |
488 flags |= EF_SHIFT_DOWN; | 489 flags |= EF_SHIFT_DOWN; |
(...skipping 29 matching lines...) Expand all Loading... |
518 return blink::WebInputEvent::IsRight; | 519 return blink::WebInputEvent::IsRight; |
519 case DomKeyLocation::NUMPAD: | 520 case DomKeyLocation::NUMPAD: |
520 return blink::WebInputEvent::IsKeyPad; | 521 return blink::WebInputEvent::IsKeyPad; |
521 case DomKeyLocation::STANDARD: | 522 case DomKeyLocation::STANDARD: |
522 break; | 523 break; |
523 } | 524 } |
524 return static_cast<blink::WebInputEvent::Modifiers>(0); | 525 return static_cast<blink::WebInputEvent::Modifiers>(0); |
525 } | 526 } |
526 | 527 |
527 } // namespace ui | 528 } // namespace ui |
OLD | NEW |