OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 TouchEventManager_h | 5 #ifndef TouchEventManager_h |
6 #define TouchEventManager_h | 6 #define TouchEventManager_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/events/PointerEventFactory.h" | 9 #include "core/events/PointerEventFactory.h" |
10 #include "platform/wtf/Allocator.h" | 10 #include "platform/wtf/Allocator.h" |
11 #include "platform/wtf/HashMap.h" | 11 #include "platform/wtf/HashMap.h" |
| 12 #include "platform/wtf/Vector.h" |
12 #include "public/platform/WebInputEventResult.h" | 13 #include "public/platform/WebInputEventResult.h" |
13 #include "public/platform/WebTouchPoint.h" | 14 #include "public/platform/WebTouchPoint.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class LocalFrame; | 18 class LocalFrame; |
18 class Document; | 19 class Document; |
19 class WebTouchEvent; | 20 class WebTouchEvent; |
20 | 21 |
21 // This class takes care of dispatching all touch events and | 22 // This class takes care of dispatching all touch events and |
(...skipping 27 matching lines...) Expand all Loading... |
49 // Does the hit-testing again if the original hit test result was not inside | 50 // Does the hit-testing again if the original hit test result was not inside |
50 // capturing frame for touch events. Returns true if touch events could be | 51 // capturing frame for touch events. Returns true if touch events could be |
51 // dispatched and otherwise returns false. | 52 // dispatched and otherwise returns false. |
52 bool ReHitTestTouchPointsIfNeeded(const WebTouchEvent&, | 53 bool ReHitTestTouchPointsIfNeeded(const WebTouchEvent&, |
53 HeapVector<TouchInfo>&); | 54 HeapVector<TouchInfo>&); |
54 | 55 |
55 // The TouchInfo array is reference just to prevent the copy. However, it | 56 // The TouchInfo array is reference just to prevent the copy. However, it |
56 // cannot be const as this function might change some of the properties in | 57 // cannot be const as this function might change some of the properties in |
57 // TouchInfo objects. | 58 // TouchInfo objects. |
58 WebInputEventResult HandleTouchEvent(const WebTouchEvent&, | 59 WebInputEventResult HandleTouchEvent(const WebTouchEvent&, |
| 60 const Vector<WebTouchEvent>&, |
59 HeapVector<TouchInfo>&); | 61 HeapVector<TouchInfo>&); |
60 | 62 |
61 // Resets the internal state of this object. | 63 // Resets the internal state of this object. |
62 void Clear(); | 64 void Clear(); |
63 | 65 |
64 // Returns whether there is any touch on the screen. | 66 // Returns whether there is any touch on the screen. |
65 bool IsAnyTouchActive() const; | 67 bool IsAnyTouchActive() const; |
66 | 68 |
67 private: | 69 private: |
68 void UpdateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&); | 70 void UpdateTargetAndRegionMapsForTouchStarts(HeapVector<TouchInfo>&); |
69 void SetAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&); | 71 void SetAllPropertiesOfTouchInfos(HeapVector<TouchInfo>&); |
70 | 72 |
71 WebInputEventResult DispatchTouchEvents(const WebTouchEvent&, | 73 WebInputEventResult DispatchTouchEvents(const WebTouchEvent&, |
| 74 const Vector<WebTouchEvent>&, |
72 const HeapVector<TouchInfo>&, | 75 const HeapVector<TouchInfo>&, |
73 bool all_touches_released); | 76 bool all_touches_released); |
74 | 77 |
75 // NOTE: If adding a new field to this class please ensure that it is | 78 // NOTE: If adding a new field to this class please ensure that it is |
76 // cleared in |TouchEventManager::clear()|. | 79 // cleared in |TouchEventManager::clear()|. |
77 | 80 |
78 const Member<LocalFrame> frame_; | 81 const Member<LocalFrame> frame_; |
79 | 82 |
80 // The target of each active touch point indexed by the touch ID. | 83 // The target of each active touch point indexed by the touch ID. |
81 using TouchTargetMap = | 84 using TouchTargetMap = |
(...skipping 18 matching lines...) Expand all Loading... |
100 // The current touch action, computed on each touch start and is | 103 // The current touch action, computed on each touch start and is |
101 // a union of all touches. Reset when all touches are released. | 104 // a union of all touches. Reset when all touches are released. |
102 TouchAction current_touch_action_; | 105 TouchAction current_touch_action_; |
103 }; | 106 }; |
104 | 107 |
105 } // namespace blink | 108 } // namespace blink |
106 | 109 |
107 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo); | 110 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::TouchEventManager::TouchInfo); |
108 | 111 |
109 #endif // TouchEventManager_h | 112 #endif // TouchEventManager_h |
OLD | NEW |