Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a670e7900b4af016dcd0871284712c9dea1e7d60
      
https://github.com/WebKit/WebKit/commit/a670e7900b4af016dcd0871284712c9dea1e7d60
  Author: Patrick Angle <pan...@apple.com>
  Date:   2023-01-30 (Mon, 30 Jan 2023)

  Changed paths:
    M Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm
    M Source/WebKit/UIProcess/_WKTouchEventGenerator.h
    M Source/WebKit/UIProcess/_WKTouchEventGenerator.mm

  Log Message:
  -----------
  WebDriver: [iPadOS] Synthetic tap events are not dispatched to the window
https://bugs.webkit.org/show_bug.cgi?id=251299
rdar://102439701

Reviewed by BJ Burg.

On iPadOS, the UIApplication.sharedApplication.keyWindow does not take Scenes 
into account, and can therefore result in
unexpected behavior when used to determine the frontmost window, namely that 
the returned window may not even be visible
on screen, but instead might be the "key" window from another Scene that the 
application has. This causes us to be
unable to get the `contextId` of the correct window, which means touch events 
were not being dispatched to the window
under automation. Instead of relying on the window under automation being 
implicitly the key window, clients should
instead provide the window in which they expect an event to take place so that 
_WKTouchEventGenerator can use that
window's `contextId` for created events, ensuring they are dispatched to the 
correct window.

iOS was unaffected because Safari does not spawn multiple scenes on that 
platform, which means the key window was
already accurate for that platform.

* Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
- Provide the window that is the target for the touch events.

(WebKit::WebAutomationSession::platformSimulateTouchInteraction):
* Source/WebKit/UIProcess/_WKTouchEventGenerator.h:
* Source/WebKit/UIProcess/_WKTouchEventGenerator.mm:
(-[_WKTouchEventGenerator _sendHIDEvent:window:]):
(-[_WKTouchEventGenerator _sendMarkerHIDEventInWindow:completionBlock:]):
- Get the `contextId` from the provided window, instead of always using the 
`keyWindow`.

(-[_WKTouchEventGenerator _updateTouchPoints:count:window:]):
(-[_WKTouchEventGenerator touchDownAtPoints:touchCount:window:]):
(-[_WKTouchEventGenerator touchDown:touchCount:window:]):
(-[_WKTouchEventGenerator liftUpAtPoints:touchCount:window:]):
(-[_WKTouchEventGenerator liftUp:touchCount:window:]):
(-[_WKTouchEventGenerator moveToPoints:touchCount:duration:window:]):
(-[_WKTouchEventGenerator touchDown:window:completionBlock:]):
(-[_WKTouchEventGenerator liftUp:window:completionBlock:]):
(-[_WKTouchEventGenerator moveToPoint:duration:window:completionBlock:]):
- Plumb the window through.

(-[_WKTouchEventGenerator touchDown:]): Deleted.
(-[_WKTouchEventGenerator liftUp:]): Deleted.
- Remove unused methods.

Canonical link: https://commits.webkit.org/259576@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to