Title: [240971] trunk/Source/WebCore
Revision
240971
Author
[email protected]
Date
2019-02-05 05:16:54 -0800 (Tue, 05 Feb 2019)

Log Message

REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
https://bugs.webkit.org/show_bug.cgi?id=194284
<rdar://problem/47774298>

Patch by Antoine Quint <[email protected]> on 2019-02-05
Reviewed by Antti Koivisto.

The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
the latter being called from Style::TreeResolver::resolveElement().

* dom/Document.cpp:
(WebCore::Document::updateTouchActionElements):
* dom/Document.h:
(WebCore::Document::touchActionElements const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240970 => 240971)


--- trunk/Source/WebCore/ChangeLog	2019-02-05 11:18:03 UTC (rev 240970)
+++ trunk/Source/WebCore/ChangeLog	2019-02-05 13:16:54 UTC (rev 240971)
@@ -1,3 +1,21 @@
+2019-02-05  Antoine Quint  <[email protected]>
+
+        REGRESSION (r240579): com.apple.WebKit.WebContent at WebCore: WebCore::Document::absoluteEventRegionForNode
+        https://bugs.webkit.org/show_bug.cgi?id=194284
+        <rdar://problem/47774298>
+
+        Reviewed by Antti Koivisto.
+
+        The m_touchActionElements list needs to be HashSet<RefPtr<Element>> instead of HashSet<Element*>. It was initially storing raw pointers based on m_touchEventTargets
+        which is an EventTargetSet (typedef’d to HashCountedSet<Node*>), but that's because these nodes have an event listener registered for them and as such are kept alive,
+        whereas elements with a touch-action property aren’t. Elements are removed from this list from Document::nodeWillBeRemoved() and from Document::updateTouchActionElements(),
+        the latter being called from Style::TreeResolver::resolveElement().
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateTouchActionElements):
+        * dom/Document.h:
+        (WebCore::Document::touchActionElements const):
+
 2019-02-05  Benjamin Poulain  <[email protected]>
 
         Hit testing functions optimizations

Modified: trunk/Source/WebCore/dom/Document.cpp (240970 => 240971)


--- trunk/Source/WebCore/dom/Document.cpp	2019-02-05 11:18:03 UTC (rev 240970)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-02-05 13:16:54 UTC (rev 240971)
@@ -8690,7 +8690,7 @@
 
     if (style.touchActions() != TouchAction::Auto) {
         if (!m_touchActionElements)
-            m_touchActionElements = std::make_unique<HashSet<Element*>>();
+            m_touchActionElements = std::make_unique<HashSet<RefPtr<Element>>>();
         changed |= m_touchActionElements->add(&element).isNewEntry;
     } else if (m_touchActionElements)
         changed |= m_touchActionElements->remove(&element);

Modified: trunk/Source/WebCore/dom/Document.h (240970 => 240971)


--- trunk/Source/WebCore/dom/Document.h	2019-02-05 11:18:03 UTC (rev 240970)
+++ trunk/Source/WebCore/dom/Document.h	2019-02-05 13:16:54 UTC (rev 240971)
@@ -1278,7 +1278,7 @@
 #endif
 #if ENABLE(POINTER_EVENTS)
     void updateTouchActionElements(Element&, const RenderStyle&);
-    const HashSet<Element*>* touchActionElements() const { return m_touchActionElements.get(); }
+    const HashSet<RefPtr<Element>>* touchActionElements() const { return m_touchActionElements.get(); }
 #endif
 
     void didAddTouchEventHandler(Node&);
@@ -1881,7 +1881,7 @@
     std::unique_ptr<EventTargetSet> m_touchEventTargets;
 #endif
 #if ENABLE(POINTER_EVENTS)
-    std::unique_ptr<HashSet<Element*>> m_touchActionElements;
+    std::unique_ptr<HashSet<RefPtr<Element>>> m_touchActionElements;
 #endif
     std::unique_ptr<EventTargetSet> m_wheelEventTargets;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to