[webkit-changes] [WebKit/WebKit] f0845c: Expose model entity transform to JS

eddydas noreply at github.com
Mon Mar 25 17:27:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0845c44e6b01ab1d954725d84b6423ff499d075
      https://github.com/WebKit/WebKit/commit/f0845c44e6b01ab1d954725d84b6423ff499d075
  Author: Eddy Wong <eddy_wong at apple.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    M Source/WebCore/Modules/model-element/HTMLModelElement.cpp
    M Source/WebCore/Modules/model-element/HTMLModelElement.h
    M Source/WebCore/Modules/model-element/HTMLModelElement.idl
    M Source/WebCore/Modules/model-element/ModelPlayer.cpp
    M Source/WebCore/Modules/model-element/ModelPlayer.h
    M Source/WebCore/Modules/model-element/ModelPlayerClient.h
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/platform/graphics/cocoa/TransformationMatrixCocoa.cpp
    M Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
    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/WebProcess/Model/ModelProcessModelPlayer.cpp
    M Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.h
    M Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.messages.in

  Log Message:
  -----------
  Expose model entity transform to JS
rdar://124986396
https://bugs.webkit.org/show_bug.cgi?id=271208

Reviewed by Alex Christensen.

Exposes the root entity transform matrix to JS side, so that developers
can move the 3D object around within the <model> tag portal.

HTMLModelTag has an m_entityTransform "truth" that's used to serve JS
getter synchronously.

ModelPlayer now has the ability to determine whether a certain transform
matrix is supported. If not, HTMLModelElement::setEntityTransform will
raise an Unsupported Exception.

Upon model load, Model Process will send an IPC message to Web Process
to update the m_entityTransform state of the HTMLModelElement to make
it aware of the default applied transform.

* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::modelPlayer const):
(WebCore::HTMLModelElement::entityTransform const):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/Modules/model-element/HTMLModelElement.idl:
* Source/WebCore/Modules/model-element/ModelPlayer.cpp:
(WebCore::ModelPlayer::entityTransform):
(WebCore::ModelPlayer::setEntityTransform):
(WebCore::ModelPlayer::supportsTransform):
* Source/WebCore/Modules/model-element/ModelPlayer.h:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

* Source/WebCore/platform/graphics/cocoa/TransformationMatrixCocoa.cpp:
(WebCore::TransformationMatrix::TransformationMatrix):
(WebCore::TransformationMatrix::operator simd_float4x4 const):
Added convenience converter methods to/from simd_float4x4, which is the commonly used transform matrix data type on visionOS.
Applicable only on Cocoa platforms.

* Source/WebCore/platform/graphics/transforms/TransformationMatrix.h:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.h:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.messages.in:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.mm:

(WebKit::ModelProcessModelPlayerProxy::transformSupported):
Require the transform to be a non-shear, uniform-scaling matrix, for now.

(WebKit::ModelProcessModelPlayerProxy::computeTransform):
(WebKit::ModelProcessModelPlayerProxy::updateTransform):
(WebKit::ModelProcessModelPlayerProxy::didFinishLoading):
(WebKit::ModelProcessModelPlayerProxy::entityTransform):
(WebKit::ModelProcessModelPlayerProxy::setEntityTransform):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.cpp:
(WebKit::ModelProcessModelPlayer::didUpdateEntityTransform):
(WebKit::ModelProcessModelPlayer::entityTransform):
(WebKit::ModelProcessModelPlayer::setEntityTransform):
(WebKit::ModelProcessModelPlayer::supportsTransform):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.h:
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.messages.in:

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



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


More information about the webkit-changes mailing list