Bug 273761 - NSEventTypeMouseExited is triggered when moving the mouse in the wkwebview
Summary: NSEventTypeMouseExited is triggered when moving the mouse in the wkwebview
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac (Apple Silicon) macOS 14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-06 02:56 PDT by xiaofeihan
Modified: 2024-05-08 09:01 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description xiaofeihan 2024-05-06 02:56:23 PDT
Reproduce steps:
1. create a wkwebview and navigate to google.com
2. Move mouse within the WkWebView
3. print the event type in `sendEvent:` of subclassing NSApplication

Expect:
NSEventTypeMouseExited don't be triggerred.

Actual:
NSEventTypeMouseExited be trigger multiple times.
Comment 1 Alexey Proskuryakov 2024-05-06 13:44:03 PDT
Thank you for the report. What makes you expect that NSEventTypeMouseExited won't be dispatched on NSApplication? AFAICT it's used for NSTrackingArea.
Comment 2 xiaofeihan 2024-05-06 17:22:29 PDT
Thanks @Alexey for the quick reply. 
IIUC, NSEventTypeMouseExited only be triggerred when uses exit a NSView? If uses only move mouse inside the WKWebView, I think it should not be triggerred.
Comment 3 Alexey Proskuryakov 2024-05-07 13:36:34 PDT
It would seem fair to expect this for events sent to the view, but not for everything dispatched through NSApplication.
Comment 4 xiaofeihan 2024-05-07 23:00:48 PDT
Sorry, I didn't get you.
When I move mouse within WKWebView(e.g move out from <input> element), `sendEvent:` of subclassing NSApplication is called with `mouseExited`. It can definitely mean that the user move out of some NSTracking area, right?
My guess is that there are many tracing area in one WKWebView, e.g one tracking are per one button/input. If so, That explains my question.
But according to WKWebView source code, I found it seems that there is only one NSTracking area for WKWebView.

https://github.com/WebKit/WebKit/blob/164aa4e39b317d71cbd408dcaa124282838b4d2f/Source/WebKit/UIProcess/mac/WebViewImpl.mm#L1158
Comment 5 Alexey Proskuryakov 2024-05-08 09:01:08 PDT
You can ask this question in Cocoa programming groups, or use a debugger to discover why it't being sent. There is no indication of a problem that needs to be fixed here.