Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75e1aa48969bfa3da5cbc154c4fec970ab804803
      
https://github.com/WebKit/WebKit/commit/75e1aa48969bfa3da5cbc154c4fec970ab804803
  Author: Sergio Villar Senin <[email protected]>
  Date:   2026-02-06 (Fri, 06 Feb 2026)

  Changed paths:
    M Source/WebCore/Modules/webxr/WebXRFrame.cpp
    M Source/WebCore/Modules/webxr/WebXRHitTestResult.cpp
    M Source/WebCore/Modules/webxr/WebXRHitTestResult.h
    M Source/WebCore/Modules/webxr/WebXRHitTestSource.cpp
    M Source/WebCore/Modules/webxr/WebXRHitTestSource.h
    M Source/WebCore/Modules/webxr/WebXRInputSource.h
    M Source/WebCore/Modules/webxr/WebXRSession.cpp
    M Source/WebCore/Modules/webxr/WebXRSession.h
    M Source/WebCore/Modules/webxr/WebXRTransientInputHitTestSource.cpp
    M Source/WebCore/Modules/webxr/WebXRTransientInputHitTestSource.h
    M Source/WebCore/testing/WebFakeXRDevice.cpp
    M Source/WebKit/UIProcess/XR/openxr/OpenXRHitTestManager.cpp

  Log Message:
  -----------
  [WebXR][HitTest] Incorrect hit test poses when not using fixed reference 
spaces
https://bugs.webkit.org/show_bug.cgi?id=306418

Reviewed by Fujii Hironori.

The hit test poses were always computed using a generated
WebXRHitTestResultSpace whose native origin was the pose of the hit
test. That's wrong because the hit tests are reported against the
reference space used to create the hit test source (or the space of the
input for transient input hit test sources).

That's why we need to pass the reference space of the source (or the
input source) to resolve the poses.

Apart from that we know keep the lists of active hit test sources in the
session as mandated by the spec. Those lists must be updated whenever
hit test sources are created and canceled. We also cleanup the hit test
sources that are no longer referenced by the application as suggested by
the specs.

The FakeXRDevice had to be adjusted to support this. It was also
assuming that the reference space was always the same. There are also
some subtleties there, the WPT tests for hit testing were developed by
Chromium folks so they are tailored for the data structures and
assumptions used in Chromium. For example the poses inside the JS code
are all specified based on the mojo (device) pose. That forces us to do
some extra conversions in the testing code to get the right results when
using different reference spaces.

* Source/WebCore/Modules/webxr/WebXRFrame.cpp:
(WebCore::WebXRFrame::getHitTestResults):
(WebCore::WebXRFrame::getHitTestResultsForTransientInput):
* Source/WebCore/Modules/webxr/WebXRHitTestResult.cpp:
(WebCore::WebXRHitTestResult::create):
(WebCore::WebXRHitTestResult::WebXRHitTestResult):
(WebCore::WebXRHitTestResult::getPose):
(WebCore::WebXRHitTestResultSpace::WebXRHitTestResultSpace): Deleted.
(): Deleted.
* Source/WebCore/Modules/webxr/WebXRHitTestResult.h:
* Source/WebCore/Modules/webxr/WebXRHitTestSource.cpp:
(WebCore::WebXRHitTestSource::create):
(WebCore::WebXRHitTestSource::WebXRHitTestSource):
(WebCore::WebXRHitTestSource::cancel):
(WebCore::WebXRHitTestSource::space const):
* Source/WebCore/Modules/webxr/WebXRHitTestSource.h:
* Source/WebCore/Modules/webxr/WebXRInputSource.h:
(WebCore::WebXRInputSource::targetRaySpace const):
* Source/WebCore/Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::cleanupInactiveHitTestSources):
(WebCore::WebXRSession::onFrame):
(WebCore::WebXRSession::requestHitTestSource):
(WebCore::WebXRSession::requestHitTestSourceForTransientInput):
(WebCore::WebXRSession::cancelHitTestSource):
(WebCore::WebXRSession::cancelTransientInputHitTestSource):
* Source/WebCore/Modules/webxr/WebXRSession.h:
* Source/WebCore/Modules/webxr/WebXRTransientInputHitTestSource.cpp:
(WebCore::WebXRTransientInputHitTestSource::cancel):
* Source/WebCore/Modules/webxr/WebXRTransientInputHitTestSource.h:
* Source/WebCore/testing/WebFakeXRDevice.cpp:
(WebCore::rigidTransformToPose):
(WebCore::SimulatedXRDevice::frameTimerFired):
(WebCore::SimulatedXRDevice::hitTestWorld):
* Source/WebKit/UIProcess/XR/openxr/OpenXRHitTestManager.cpp:
(WebKit::OpenXRHitTestManager::OpenXRHitTestManager):

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



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

Reply via email to