Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 63d6cf248df1e0ed4f2fd51fe72a4ee061714ad9
      
https://github.com/WebKit/WebKit/commit/63d6cf248df1e0ed4f2fd51fe72a4ee061714ad9
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-01-27 (Tue, 27 Jan 2026)

  Changed paths:
    M LayoutTests/fast/events/mouse-relative-position-expected.txt
    M LayoutTests/fast/events/mouse-relative-position.html
    M 
LayoutTests/imported/w3c/web-platform-tests/uievents/mouse/layer-coords-transform-expected.txt
    M Source/WebCore/dom/MouseRelatedEvent.cpp

  Log Message:
  -----------
  layerX/layerY return incorrect values with CSS transforms
https://bugs.webkit.org/show_bug.cgi?id=306314
rdar://168968832

Reviewed by Lily Spiniolas and Abrar Rahman Protyasha.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

The layerX and layerY properties were computed by walking up the layer
tree and subtracting each layer's location(). This approach fails with
CSS transforms because layer locations are in local coordinate space
and don't account for transforms applied to parent layers.

It doesn't make sense not to include transforms when subtracting the
layer offset, because before this subtraction the mouse position value
already includes transforms (via absoluteLocation which applies the
documentToAbsoluteScaleFactor).

Fix by computing the layer's position in absolute coordinates using
localToAbsolute() with UseTransforms, matching Chromium's approach.
This ensures both the mouse position and layer position are in the
same coordinate system before computing their relative offset.

See: https://github.com/w3c/uievents/issues/398

* Source/WebCore/dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::computeRelativePosition):
* 
LayoutTests/imported/w3c/web-platform-tests/uievents/mouse/layer-coords-transform-expected.txt:
 Progression
* LayoutTests/fast/events/mouse-relative-position-expected.txt:
* LayoutTests/fast/events/mouse-relative-position.html:

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



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

Reply via email to