[webkit-changes] [WebKit/WebKit] e120ba: Web Automation: Dispatched mouse events always hav...
Abrar Rahman Protyasha
noreply at github.com
Wed Sep 27 12:49:55 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e120ba1e5646832a96d479a7d6a629a1e7d639f2
https://github.com/WebKit/WebKit/commit/e120ba1e5646832a96d479a7d6a629a1e7d639f2
Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
Date: 2023-09-27 (Wed, 27 Sep 2023)
Changed paths:
M Source/WebCore/dom/PointerEvent.cpp
M Source/WebCore/dom/PointerEvent.h
M Source/WebCore/dom/ios/PointerEventIOS.cpp
M Source/WebKit/UIProcess/Automation/WebAutomationSession.h
M Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm
Log Message:
-----------
Web Automation: Dispatched mouse events always have `buttons` property set to zero
https://bugs.webkit.org/show_bug.cgi?id=262109
rdar://116049187
Reviewed by Wenson Hsieh.
Pointer events dispatched by WebAutomationSession uncondtionally have
their `buttons` property set to zero. This is because the `buttons`
property is assigned by consulting the `+[NSEvent pressedMouseButtons]`
method, which does not account for NSEvent objects created through
eventSender in our test harness, and as such always reports that we have
not pressed any mouse buttons.
To fix this, we keep track of the mouse button currently being pressed
down in WebAutomationSession, and reflect that in a swizzled
`+[NSEvent pressedMouseButtons]` definition.
Note that with this patch we now pass the following assertion in the
pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse WPT:
```
mouse pointerdown.buttons attribute is 1 when left mouse button is pressed.
```
* Source/WebCore/dom/PointerEvent.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/dom/PointerEvent.h:
* Source/WebCore/dom/ios/PointerEventIOS.cpp:
(WebCore::buttonsForType): Deleted.
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
* Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
(WebKit::WebAutomationSession::platformSimulateMouseInteraction):
Canonical link: https://commits.webkit.org/268529@main
More information about the webkit-changes
mailing list