| 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 #ifndef UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ | 5 #ifndef UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ |
| 6 #define UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ | 6 #define UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 10 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 11 #include "ui/events/gesture_detection/motion_event.h" | 11 #include "ui/events/gesture_detection/motion_event.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class TimeDelta; | 14 class TimeDelta; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 class WebGestureEvent; | 18 class WebGestureEvent; |
| 19 class WebInputEvent; | 19 class WebInputEvent; |
| 20 class WebTouchEvent; | 20 class WebTouchEvent; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class PointF; | 24 class PointF; |
| 25 class Vector2d; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace ui { | 28 namespace ui { |
| 28 enum class DomCode; | 29 enum class DomCode; |
| 29 struct GestureEventData; | 30 struct GestureEventData; |
| 30 struct GestureEventDetails; | 31 struct GestureEventDetails; |
| 31 class MotionEvent; | 32 class MotionEvent; |
| 32 | 33 |
| 33 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 34 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
| 34 const MotionEvent& event, | 35 const MotionEvent& event, |
| 35 bool may_cause_scrolling); | 36 bool may_cause_scrolling); |
| 36 | 37 |
| 37 blink::WebGestureEvent CreateWebGestureEvent(const GestureEventDetails& details, | 38 blink::WebGestureEvent CreateWebGestureEvent(const GestureEventDetails& details, |
| 38 base::TimeTicks timestamp, | 39 base::TimeTicks timestamp, |
| 39 const gfx::PointF& location, | 40 const gfx::PointF& location, |
| 40 const gfx::PointF& raw_location, | 41 const gfx::PointF& raw_location, |
| 41 int flags, | 42 int flags, |
| 42 uint32_t unique_touch_event_id); | 43 uint32_t unique_touch_event_id); |
| 43 | 44 |
| 44 // Convenience wrapper for |CreateWebGestureEvent| using the supplied |data|. | 45 // Convenience wrapper for |CreateWebGestureEvent| using the supplied |data|. |
| 45 blink::WebGestureEvent CreateWebGestureEventFromGestureEventData( | 46 blink::WebGestureEvent CreateWebGestureEventFromGestureEventData( |
| 46 const GestureEventData& data); | 47 const GestureEventData& data); |
| 47 | 48 |
| 48 int EventFlagsToWebEventModifiers(int flags); | 49 int EventFlagsToWebEventModifiers(int flags); |
| 49 | 50 |
| 50 std::unique_ptr<blink::WebInputEvent> ScaleWebInputEvent( | 51 std::unique_ptr<blink::WebInputEvent> ScaleWebInputEvent( |
| 51 const blink::WebInputEvent& event, | 52 const blink::WebInputEvent& event, |
| 52 float scale); | 53 float scale); |
| 53 | 54 |
| 55 // Transforms coordinates and other properties of |event|, by |
| 56 // 1) translating / shifting by |delta| and |
| 57 // 2) scaling by |scale|. |
| 58 // If |event| does not need to change, returns nullptr. |
| 59 // Otherwise, returns the transformed version of |event|. |
| 60 std::unique_ptr<blink::WebInputEvent> TranslateAndScaleWebInputEvent( |
| 61 const blink::WebInputEvent& event, |
| 62 const gfx::Vector2d& delta, |
| 63 float scale); |
| 64 |
| 54 blink::WebPointerProperties::PointerType ToWebPointerType( | 65 blink::WebPointerProperties::PointerType ToWebPointerType( |
| 55 MotionEvent::ToolType tool_type); | 66 MotionEvent::ToolType tool_type); |
| 56 | 67 |
| 57 int WebEventModifiersToEventFlags(int modifiers); | 68 int WebEventModifiersToEventFlags(int modifiers); |
| 58 | 69 |
| 59 blink::WebInputEvent::Modifiers DomCodeToWebInputEventModifiers( | 70 blink::WebInputEvent::Modifiers DomCodeToWebInputEventModifiers( |
| 60 ui::DomCode code); | 71 ui::DomCode code); |
| 61 | 72 |
| 62 } // namespace ui | 73 } // namespace ui |
| 63 | 74 |
| 64 #endif // UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ | 75 #endif // UI_EVENTS_BLINK_BLINK_EVENT_UTIL_H_ |
| OLD | NEW |