Bug 188561 - mouseenter and mouseleave events don't get dispatched even when there is a capturing event listener for a slot ancestor
Summary: mouseenter and mouseleave events don't get dispatched even when there is a ca...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks: 148695
  Show dependency treegraph
 
Reported: 2018-08-14 10:46 PDT by Olli Pettay (:smaug)
Modified: 2018-09-10 14:54 PDT (History)
9 users (show)

See Also:


Attachments
testcase, move mouse to top left corner, open console and reload and move mouse per instructions (1.07 KB, text/html)
2018-08-14 10:46 PDT, Olli Pettay (:smaug)
no flags Details
Fixes the bug (21.08 KB, patch)
2018-09-07 19:11 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-sierra (2.30 MB, application/zip)
2018-09-07 20:16 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-sierra (3.02 MB, application/zip)
2018-09-07 20:54 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (2.27 MB, application/zip)
2018-09-07 21:08 PDT, Build Bot
no flags Details
Fixed tests (20.16 KB, patch)
2018-09-07 22:14 PDT, Ryosuke Niwa
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olli Pettay (:smaug) 2018-08-14 10:46:21 PDT
Created attachment 347090 [details]
testcase, move mouse to top left corner, open console and reload and move mouse per instructions

Per UIEvent spec, mouseenter/leave are composed events, so they do propagate from shadow DOM to host.
But, assuming I'm reading the code right, the optimizations in EventHandler.cpp make mouseenter/leave handling depend on whether there are capturing event listeners, even though the listener on host can be
bubbling listener, since when event is handled at that level, it is AT_TARGET, and all the listeners should be called.

https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/page/EventHandler.cpp#L2529
Comment 1 Ryosuke Niwa 2018-09-07 00:33:23 PDT
(In reply to Olli Pettay (:smaug) from comment #0)
> Created attachment 347090 [details]
> testcase, move mouse to top left corner, open console and reload and move
> mouse per instructions
> 
> Per UIEvent spec, mouseenter/leave are composed events, so they do propagate
> from shadow DOM to host.
> But, assuming I'm reading the code right, the optimizations in
> EventHandler.cpp make mouseenter/leave handling depend on whether there are
> capturing event listeners, even though the listener on host can be
> bubbling listener, since when event is handled at that level, it is
> AT_TARGET, and all the listeners should be called.

The bubbling event listeners are checked as we walk up the ancestors:
https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/page/EventHandler.cpp#L2571

The bug we have is that we're not walking up past the shadow root here.
We also need to make these events not-composed per https://github.com/w3c/uievents/issues/208
Comment 2 Ryosuke Niwa 2018-09-07 19:11:44 PDT
Created attachment 349229 [details]
Fixes the bug
Comment 3 Build Bot 2018-09-07 20:16:09 PDT
Comment on attachment 349229 [details]
Fixes the bug

Attachment 349229 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/9136486

New failing tests:
fast/events/shadow-event-path.html
Comment 4 Build Bot 2018-09-07 20:16:11 PDT
Created attachment 349234 [details]
Archive of layout-test-results from ews102 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 5 Build Bot 2018-09-07 20:53:59 PDT
Comment on attachment 349229 [details]
Fixes the bug

Attachment 349229 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/9136533

New failing tests:
fast/events/shadow-event-path.html
Comment 6 Build Bot 2018-09-07 20:54:01 PDT
Created attachment 349236 [details]
Archive of layout-test-results from ews116 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 7 Build Bot 2018-09-07 21:08:23 PDT
Comment on attachment 349229 [details]
Fixes the bug

Attachment 349229 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/9136558

New failing tests:
fast/shadow-dom/mouseenter-mouseleave-across-shadow-boundary.html
fast/shadow-dom/mouseenter-mouseleave-inside-shadow-tree.html
fast/shadow-dom/mouseenter-mouseleave-on-slot-parent.html
Comment 8 Build Bot 2018-09-07 21:08:25 PDT
Created attachment 349237 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.4
Comment 9 Ryosuke Niwa 2018-09-07 22:14:10 PDT
Created attachment 349242 [details]
Fixed tests
Comment 10 Radar WebKit Bug Importer 2018-09-07 22:37:08 PDT
<rdar://problem/44251774>
Comment 11 Ryosuke Niwa 2018-09-10 14:52:31 PDT
Thanks for the reviews!
Comment 12 Ryosuke Niwa 2018-09-10 14:54:16 PDT
Committed r235865: <https://trac.webkit.org/changeset/235865>