Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8889b46654d9a9bfb2833fd351030aae4b239516
      
https://github.com/WebKit/WebKit/commit/8889b46654d9a9bfb2833fd351030aae4b239516
  Author: Aleksei Marchenko <[email protected]>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    A LayoutTests/spatial-css/spatial-portal-anchor-resolution-expected.txt
    A LayoutTests/spatial-css/spatial-portal-anchor-resolution.html
    A LayoutTests/spatial-css/spatial-portal-anchor-unresolved-expected.txt
    A LayoutTests/spatial-css/spatial-portal-anchor-unresolved.html
    M Source/WebCore/Modules/model-element/HTMLModelElement.cpp
    M Source/WebCore/Modules/model-element/HTMLModelElement.h
    M Source/WebCore/Modules/model-element/ModelPlayer.cpp
    M Source/WebCore/Modules/model-element/ModelPlayer.h
    M Source/WebCore/Modules/model-element/SpatialPortalController.cpp
    M Source/WebCore/Modules/model-element/SpatialPortalController.h
    M Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
    M Source/WebCore/style/values/anchor-position/StylePositionAnchor.h
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.h
    M Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.messages.in
    M Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.mm
    M Source/WebKit/WebKitSwift/RealityKit/WKRKEntity.h
    M Source/WebKit/WebKitSwift/RealityKit/WKRKEntity.swift
    M Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.cpp
    M Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.h

  Log Message:
  -----------
  Make CSS position-anchor functional for <model> in a spatial portal
https://bugs.webkit.org/show_bug.cgi?id=324600
rdar://182292444

Reviewed by Mike Wyrzykowski and Etienne Segonzac.

A <model> with `position-anchor: --name#placement` and `position-context: 
anchor` is
parented onto the named entity inside the anchor model's asset, inheriting its 
host's
position, rotation, scale and animation through the RealityKit hierarchy.

WebCore resolves every anchor in the portal in one pass, so changing or 
removing one
model's anchor-name re-resolves the models pointing at it; self-anchoring and 
cycles
are rejected with a warning. The model process likewise keeps the anchor per 
node and
reapplies them all on every load, unload and change, so nothing depends on the 
order
assets arrive in.

A placement supplies position only: whatever orientation its asset gave it is 
undone
with a rotation captured when the child is anchored, so the child takes its 
host's
orientation and CSS composes from upright. Captured rather than recomputed, so 
an
animated joint above the placement still carries the child. Non-uniform 
placement
scale is unsupported, as elsewhere in the feature.

Tests: spatial-css/spatial-portal-anchor-resolution.html
       spatial-css/spatial-portal-anchor-unresolved.html

* LayoutTests/spatial-css/spatial-portal-anchor-resolution-expected.txt: Added.
* LayoutTests/spatial-css/spatial-portal-anchor-resolution.html: Added.
* LayoutTests/spatial-css/spatial-portal-anchor-unresolved-expected.txt: Added.
* LayoutTests/spatial-css/spatial-portal-anchor-unresolved.html: Added.
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::updateAnchorFromCSS):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/Modules/model-element/ModelPlayer.cpp:
(WebCore::ModelPlayer::setAnchor):
* Source/WebCore/Modules/model-element/ModelPlayer.h:
* Source/WebCore/Modules/model-element/SpatialPortalController.cpp:
(WebCore::SpatialPortalController::unregisterChildModel):
(WebCore::SpatialPortalController::registerChildModel):
(WebCore::SpatialPortalController::loadChildModelIfReady):
(WebCore::SpatialPortalController::deleteModelPlayer):
(WebCore::SpatialPortalController::unloadChildModel):
(WebCore::SpatialPortalController::anchorModelForChild const):
(WebCore::SpatialPortalController::collectAnchorNames const):
(WebCore::SpatialPortalController::anchorNodeForName):
(WebCore::SpatialPortalController::anchorChainReaches const):
(WebCore::SpatialPortalController::resolvedAnchorNode const):
(WebCore::SpatialPortalController::updateAnchorForChild):
(WebCore::SpatialPortalController::updateAnchors):
(WebCore::SpatialPortalController::scheduleAnchorUpdate):
(WebCore::SpatialPortalController::addConsoleWarning const):
(WebCore::SpatialPortalController::logWarning):
* Source/WebCore/Modules/model-element/SpatialPortalController.h:
* Source/WebCore/rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateElementRenderer):
* Source/WebCore/style/values/anchor-position/StylePositionAnchor.h:
(WebCore::Style::PositionAnchor::tryAttachment const):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::spatialPortalAnchorForModel):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.h:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.messages.in:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.mm:
(WebKit::ModelProcessModelPlayerProxy::anchorPlacementScale const):
(WebKit::ModelProcessModelPlayerProxy::childEntityTransformSRT const):
(WebKit::ModelProcessModelPlayerProxy::updateAnchorParenting):
(WebKit::ModelProcessModelPlayerProxy::setAnchor):
(WebKit::ModelProcessModelPlayerProxy::didFinishLoading):
(WebKit::ModelProcessModelPlayerProxy::unloadModel):
(WebKit::ModelProcessModelPlayerProxy::teardownEntity):
* Source/WebKit/WebKitSwift/RealityKit/WKRKEntity.h:
* Source/WebKit/WebKitSwift/RealityKit/WKRKEntity.swift:
(WKRKEntity.coreEntity):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.cpp:
(WebKit::ModelProcessModelPlayer::setAnchor):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.h:

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



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

Reply via email to