Index: third_party/WebKit/Source/core/input/TouchEventManager.h |
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.h b/third_party/WebKit/Source/core/input/TouchEventManager.h |
index d1a953024fa22033c7cc8618bb244ffbc3632342..289ec095c4cec6193074314835e28df036c5c871 100644 |
--- a/third_party/WebKit/Source/core/input/TouchEventManager.h |
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.h |
@@ -12,14 +12,15 @@ |
#include "platform/wtf/Allocator.h" |
#include "platform/wtf/HashMap.h" |
#include "platform/wtf/Vector.h" |
+#include "public/platform/WebCoalescedInputEvent.h" |
#include "public/platform/WebInputEventResult.h" |
+#include "public/platform/WebPointerEvent.h" |
#include "public/platform/WebTouchPoint.h" |
namespace blink { |
class LocalFrame; |
class Document; |
-class WebTouchEvent; |
// This class takes care of dispatching all touch events and |
// maintaining related states. |
@@ -32,12 +33,11 @@ class CORE_EXPORT TouchEventManager |
explicit TouchEventManager(LocalFrame&); |
DECLARE_TRACE(); |
- // The entries in touch point array of WebTouchEvent (i.e. first parameter) |
- // correspond to the entries of the PointerEventTargets (i.e. last parameter). |
- WebInputEventResult HandleTouchEvent( |
- const WebTouchEvent&, |
- const Vector<WebTouchEvent>&, |
- const HeapVector<EventHandlingUtil::PointerEventTarget>&); |
+ void HandleTouchPoint(const WebPointerEvent&, |
+ const Vector<WebPointerEvent>&, |
+ const EventHandlingUtil::PointerEventTarget&); |
+ |
+ WebInputEventResult HandleVSyncSignal(); |
// Resets the internal state of this object. |
void Clear(); |
@@ -46,46 +46,55 @@ class CORE_EXPORT TouchEventManager |
bool IsAnyTouchActive() const; |
private: |
- Touch* CreateDomTouch(const WebTouchPoint&, bool* known_target); |
- |
- void UpdateTargetAndRegionMapsForTouchStart( |
- const WebTouchPoint&, |
+ class TouchPointAttributes |
+ : public GarbageCollectedFinalized<TouchPointAttributes> { |
+ public: |
+ DEFINE_INLINE_TRACE() { visitor->Trace(target_); } |
+ |
+ TouchPointAttributes() {} |
+ explicit TouchPointAttributes(WebPointerEvent event) |
+ : event_(event), stale_(false) {} |
+ |
+ // Last state of the touch point. |
+ WebPointerEvent event_; |
+ // The list of coalesced events if there is any. Note that at the end of |
mustaq
2017/06/09 16:12:27
Please clarify if this list include all TEs, or on
Navid Zolghadr
2017/06/12 16:17:32
Done.
|
+ // each frame this list gets cleared. |
+ Vector<WebPointerEvent> coalesced_events_; |
+ Member<Node> target_; // The target of each active touch point. |
+ String region_; // // The region of each active touch point. |
+ bool stale_; |
+ }; |
+ |
+ WebCoalescedInputEvent GenerateWebCoalescedInputEvent(); |
+ Touch* CreateDomTouch(const TouchPointAttributes*, bool* known_target); |
+ void allTouchesReleasedCleanup(); |
+ |
+ // Keeps track of attributes of the touch point in the |
+ // |touch_points_attributes_| map and does the hit-testing if the original hit |
+ // test result was not inside capturing frame |touch_sequence_document_| for |
+ // touch events. |
+ void UpdateTouchAttributeMapsForPointerDown( |
+ const WebPointerEvent&, |
const EventHandlingUtil::PointerEventTarget&); |
- // Does the hit-testing if the original hit test result was not inside |
- // capturing frame for touch events. Returns true if touch events could be |
- // dispatched and otherwise returns false. |
- bool HitTestTouchPointsIfNeeded( |
- const WebTouchEvent&, |
- const HeapVector<EventHandlingUtil::PointerEventTarget>&); |
- |
- WebInputEventResult DispatchTouchEvents(const WebTouchEvent&, |
- const Vector<WebTouchEvent>&, |
- bool all_touches_released); |
+ WebInputEventResult DispatchTouchEvents(); |
mustaq
2017/06/09 16:12:29
Rename to something like DispatchAccumulatedTouchE
Navid Zolghadr
2017/06/12 16:17:32
Done.
|
// NOTE: If adding a new field to this class please ensure that it is |
// cleared in |TouchEventManager::clear()|. |
const Member<LocalFrame> frame_; |
- // The target of each active touch point indexed by the touch ID. |
- using TouchTargetMap = |
- HeapHashMap<unsigned, |
- Member<Node>, |
- DefaultHash<unsigned>::Hash, |
- WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; |
- TouchTargetMap target_for_touch_id_; |
- using TouchRegionMap = HashMap<unsigned, |
- String, |
- DefaultHash<unsigned>::Hash, |
- WTF::UnsignedWithZeroKeyHashTraits<unsigned>>; |
- TouchRegionMap region_for_touch_id_; |
+ using TouchAttributeMap = |
mustaq
2017/06/09 16:12:27
Please keep the past comment re "indexed by touch
Navid Zolghadr
2017/06/12 16:17:32
Done.
|
+ HeapHashMap<int, |
+ Member<TouchPointAttributes>, |
+ WTF::IntHash<int>, |
+ WTF::UnsignedWithZeroKeyHashTraits<int>>; |
+ TouchAttributeMap touch_points_attributes_; |
mustaq
2017/06/09 16:12:29
Nit: I would avoid double plural in the name. s/to
Navid Zolghadr
2017/06/12 16:17:32
Done.
|
// If set, the document of the active touch sequence. Unset if no touch |
// sequence active. |
Member<Document> touch_sequence_document_; |
- bool touch_pressed_; |
bool suppressing_touchmoves_within_slop_; |
// The current touch action, computed on each touch start and is |