script: Focus on mousedown instead of mouse click according to spec (#38589)

- Focus on mousedown instead of mouse click according to
[spec](https://w3c.github.io/uievents/#handle-native-mouse-down)
- Refactor to follow spec closer and make things more clear.
- Add some spec link.
- Remove some dead spec link.

Still some preparation before implementing #38435.
Testing: No regression in WebDriver & WPT. But update some outdated
test.
Fixes: #38588

---------

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-08-12 10:40:21 +08:00 committed by GitHub
parent d2122c8bd8
commit 5d21234872
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 69 additions and 31 deletions

View file

@ -222,6 +222,7 @@ impl MouseEvent {
}
/// Create a [MouseEvent] triggered by the embedder
/// <https://w3c.github.io/uievents/#create-a-cancelable-mouseevent-id>
pub(crate) fn for_platform_mouse_event(
event: embedder_traits::MouseButtonEvent,
pressed_mouse_buttons: u16,