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