iOS: Prepare deploying Ref/RefPtr in touch event code
https://bugs.webkit.org/show_bug.cgi?id=206466

Reviewed by Wenson Hsieh.

Introduce a new variant of dispatchTouchEvent, which takes EventTargetTouchArrayMap that uses
Ref<EventTarget> as keys instead of raw pointers to EventTarget as is the case in EventTargetTouchMap.

* page/EventHandler.h:
(WebCore::EventHandler::EventTargetTouchArrayMap): Added.
(WebCore::EventHandler::dispatchTouchEvent): Added the declaration for new variant.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@254789 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7538bcf..01bfb1f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2020-01-17  Ryosuke Niwa  <rniwa@webkit.org>
+
+        iOS: Prepare deploying Ref/RefPtr in touch event code
+        https://bugs.webkit.org/show_bug.cgi?id=206466
+
+        Reviewed by Wenson Hsieh.
+
+        Introduce a new variant of dispatchTouchEvent, which takes EventTargetTouchArrayMap that uses
+        Ref<EventTarget> as keys instead of raw pointers to EventTarget as is the case in EventTargetTouchMap.
+
+        * page/EventHandler.h:
+        (WebCore::EventHandler::EventTargetTouchArrayMap): Added.
+        (WebCore::EventHandler::dispatchTouchEvent): Added the declaration for new variant.
+
 2020-01-17  Megan Gardner  <megan_gardner@apple.com>
 
         Use Visible Position to calculate Positions for highlights
diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h
index c6dc5bf..d33ad47 100644
--- a/Source/WebCore/page/EventHandler.h
+++ b/Source/WebCore/page/EventHandler.h
@@ -220,6 +220,7 @@
 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS)
     using TouchArray = Vector<RefPtr<Touch>>;
     using EventTargetTouchMap = HashMap<EventTarget*, TouchArray*>;
+    using EventTargetTouchArrayMap = HashMap<Ref<EventTarget>, std::unique_ptr<TouchArray>>;
 #endif
 
 #if ENABLE(IOS_TOUCH_EVENTS) || ENABLE(IOS_GESTURE_EVENTS) || ENABLE(MAC_GESTURE_EVENTS)
@@ -228,6 +229,7 @@
 
 #if ENABLE(IOS_TOUCH_EVENTS)
     bool dispatchTouchEvent(const PlatformTouchEvent&, const AtomString&, const EventTargetTouchMap&, float, float);
+    bool dispatchTouchEvent(const PlatformTouchEvent&, const AtomString&, const EventTargetTouchArrayMap&, float, float);
     bool dispatchSimulatedTouchEvent(IntPoint location);
     Frame* touchEventTargetSubframe() const { return m_touchEventTargetSubframe.get(); }
     const TouchArray& touches() const { return m_touches; }