Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a39166fd0ab3b6d329a33075ef2ddbfdcd0ca89f
https://github.com/WebKit/WebKit/commit/a39166fd0ab3b6d329a33075ef2ddbfdcd0ca89f
Author: Ryosuke Niwa <[email protected]>
Date: 2024-01-12 (Fri, 12 Jan 2024)
Changed paths:
A
LayoutTests/fast/events/touch/ios/touch-event-after-document-open-expected.txt
A LayoutTests/fast/events/touch/ios/touch-event-after-document-open.html
A LayoutTests/fast/events/wheel/wheel-event-after-document-open-expected.txt
A LayoutTests/fast/events/wheel/wheel-event-after-document-open.html
M LayoutTests/platform/gtk/TestExpectations
M LayoutTests/platform/wpe/TestExpectations
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Node.cpp
M Source/WebCore/dom/Node.h
Log Message:
-----------
Wheel event doesn't get fired on an element that has been reinserted after
document.open
https://bugs.webkit.org/show_bug.cgi?id=267399
Reviewed by Wenson Hsieh.
The bug was caused by Document::removeAllEventListeners falsely assuming that
all wheel and touch
event listeners from all nodes associated with this document are removed. This
is not the case.
Document::removeAllEventListeners does not remove any event listeners from
disconnected nodes.
Fixed the bug by relying on newly added Node::removeAllEventListeners to remove
itself from
Document's maps of wheel and touch event listeners instead of clearing them all
in
Document::removeAllEventListeners. Node::removeAllEventListeners won't be
called on any
disconnected nodes and they would remain in the document's maps.
An alternative approach is for Document to keep track of only connected Nodes
which have touch
and wheel event listeners but this will involve adding code to
Node::insertedIntoAncestor and
Node::removedFromAncestor to add or remove nodes from Document's maps. We opt
not to adopt this
approach since it incurs runtime cost of O(k) where k is the maximum number of
event listeners.
*
LayoutTests/fast/events/touch/ios/touch-event-after-document-open-expected.txt:
Added.
* LayoutTests/fast/events/touch/ios/touch-event-after-document-open.html: Added.
* LayoutTests/fast/events/wheel/wheel-event-after-document-open-expected.txt:
Added.
* LayoutTests/fast/events/wheel/wheel-event-after-document-open.html: Added.
* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::removeAllEventListeners):
* Source/WebCore/dom/Node.cpp:
(WebCore::didRemoveEventListenerOfType): Extracted from tryRemoveEventListener.
(WebCore::tryRemoveEventListener): Deleted.
(WebCore::Node::removeEventListener):
(WebCore::Node::removeAllEventListeners): Added.
* Source/WebCore/dom/Node.h:
Canonical link: https://commits.webkit.org/272960@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes