Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dfaf47f5fc32144022168314298a7f2ca6707102
      
https://github.com/WebKit/WebKit/commit/dfaf47f5fc32144022168314298a7f2ca6707102
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/touch-events/resources/post-message-pointer-screen-coordinates.html
    A 
LayoutTests/http/tests/site-isolation/touch-events/tap-pointer-event-screen-coordinates-in-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/touch-events/tap-pointer-event-screen-coordinates-in-cross-origin-iframe.html
    M Source/WebCore/dom/MouseEvent.h
    M Source/WebCore/dom/ios/MouseEventIOS.cpp
    M Source/WebCore/dom/ios/PointerEventIOS.cpp

  Log Message:
  -----------
  [Site Isolation] [iOS] Pointer events from touch input have incorrect screen 
coordinates
https://bugs.webkit.org/show_bug.cgi?id=325130

Reviewed by Lily Spiniolas and Wenson Hsieh.

On iOS a screenX/screenY is a point in the top-level page's root view rather 
than device screen
space. PointerEvent's PlatformTouchEvent constructor in PointerEventIOS.cpp 
passed the touch location
as both its screen and window location, but that location is in the local root 
frame's root view:
EventHandler::handleTouchEvent() hands the event unchanged to local subframes 
and transforms it into
remote frame coordinates when handing it off to another process. With site 
isolation the local root
frame can be a cross-origin iframe, so pointer events from a touch inside one 
reported screenX/screenY
relative to the iframe. MouseEvent's PlatformTouchEvent constructor in 
MouseEventIOS.cpp, which creates
the simulated mouse events some sites are quirked to receive, had the same 
problem.

Add MouseEvent::screenLocationForTouchAtIndex(), which maps the touch location 
up to the main frame's
root view with FrameView::convertToRootViewAcrossIsolatedFrames(), the same way 
321763@main did for the
synthetic mouse events a tap dispatches, and use it for the screen location of 
both events. It returns
the touch location unchanged when the local root frame is the main frame, 
leaving the main frame's
process unaffected. The window location is untouched, so clientX/pageX behavior 
is unchanged.

In the PointerEvent constructor, pass view.copyRef() rather than 
WTF::move(view) to the base class,
since screenLocationForTouchAtIndex() reads view in the same argument list and 
the order in which
arguments are evaluated is unspecified.

Test: 
http/tests/site-isolation/touch-events/tap-pointer-event-screen-coordinates-in-cross-origin-iframe.html

* 
LayoutTests/http/tests/site-isolation/touch-events/resources/post-message-pointer-screen-coordinates.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/touch-events/tap-pointer-event-screen-coordinates-in-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/touch-events/tap-pointer-event-screen-coordinates-in-cross-origin-iframe.html:
 Added.
* Source/WebCore/dom/MouseEvent.h:
* Source/WebCore/dom/ios/MouseEventIOS.cpp:
(WebCore::MouseEvent::screenLocationForTouchAtIndex):
(WebCore::MouseEvent::create):
* Source/WebCore/dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::PointerEvent):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to