Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1f64f6a35a3bb997fdb54b3690a88658406dc6ee
      
https://github.com/WebKit/WebKit/commit/1f64f6a35a3bb997fdb54b3690a88658406dc6ee
  Author: Ruthvik Konda <[email protected]>
  Date:   2026-06-17 (Wed, 17 Jun 2026)

  Changed paths:
    M 
Source/WebCore/Modules/WebGPU/Implementation/WebGPUCompositorIntegrationImpl.cpp
    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/platform/graphics/cocoa/IOSurface.h
    M Source/WebCore/platform/graphics/cocoa/IOSurface.mm
    M Source/WebCore/rendering/RenderModel.cpp
    M Source/WebCore/rendering/RenderModel.h
    M Source/WebKit/GPUProcess/graphics/Model/MeshImpl.cpp
    M Source/WebKit/GPUProcess/graphics/Model/MeshImpl.h
    M Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.cpp
    M Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.h
    M Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.messages.in
    M Source/WebKit/WebProcess/GPU/graphics/Model/RemoteMeshProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/Model/RemoteMeshProxy.h
    M Source/WebKit/WebProcess/Model/Mesh.h
    M Source/WebKit/WebProcess/Model/WebModelPlayer.h
    M Source/WebKit/WebProcess/Model/WebModelPlayer.mm

  Log Message:
  -----------
  [model] <model> element is not captured in Tab Overview snapshots on macOS
https://bugs.webkit.org/show_bug.cgi?id=317291
rdar://178453822

Reviewed by Mike Wyrzykowski.

The model's frame is composited out of the render tree (rendered in the GPU 
process and
presented through its own layer), so software-paint snapshots such as Tab 
Overview thumbnails
did not capture it, leaving the model area blank.

Two earlier strategies did not work. Mimicking iOS by asking the render server 
to photograph
the already-composited layers (CARenderServerSnapshot) regressed <video> to 
black on macOS:
the render server only includes another process's hosted content when 
snapshotting from the
owning layer group, and the only group reachable from the macOS thumbnail code 
is the
WebContent process's group, a different security domain, so the GPU-process 
video layer is
gated out. Painting the model's frame in the WebContent process by 
materializing its IOSurface
(createFromSendRight) also left the model blank, because the sandboxed 
WebContent process
cannot redeem the GPU process's IOSurface handle.

Instead, add a snapshot path to RenderModel::paintReplaced: under 
PaintBehavior::Snapshotting,
ask the model player for its current frame as an ImageBuffer and draw that into 
the snapshot
context, the same way <canvas> and <video> are captured. WebModelPlayer 
produces the frame by
having the GPU process draw its current render buffer into a GPU-process-backed 
ImageBuffer
(device-pixel sized) resolved by RenderingResourceIdentifier, so WebContent 
never materializes
the surface; this mirrors the WebGPU canvas snapshot readback. Players that 
cannot produce a
frame return nullptr so nothing is drawn (no wasted allocation).

The render buffers are allocated before the first frame is drawn, and an 
undrawn buffer would
composite as opaque black, so WebModelPlayer tracks m_hasRenderedFrame and only 
produces a
snapshot frame once a render has completed; it is reset whenever the display 
buffers are
(re)allocated or released so a stale value cannot expose an undrawn buffer.

Also extract the shared IOSurface-to-NativeImage conversion into 
IOSurface::createNativeImage().

* 
Source/WebCore/Modules/WebGPU/Implementation/WebGPUCompositorIntegrationImpl.cpp:
(WebCore::WebGPU::CompositorIntegrationImpl::withDisplayBufferAsNativeImage):
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::paintCurrentFrameInContext):
* Source/WebCore/Modules/model-element/HTMLModelElement.h:
* Source/WebCore/Modules/model-element/ModelPlayer.cpp:
(WebCore::ModelPlayer::snapshotCurrentFrame):
* Source/WebCore/Modules/model-element/ModelPlayer.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.h:
* Source/WebCore/platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::createNativeImage):
* Source/WebCore/rendering/RenderModel.cpp:
(WebCore::RenderModel::paintReplaced):
* Source/WebCore/rendering/RenderModel.h:
* Source/WebKit/GPUProcess/graphics/Model/MeshImpl.cpp:
(WebKit::MeshImpl::getCurrentFrameAsNativeImage):
* Source/WebKit/GPUProcess/graphics/Model/MeshImpl.h:
* Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.cpp:
(WebKit::RemoteMesh::paintCurrentFrameToImageBuffer):
* Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.h:
* Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.messages.in:
* Source/WebKit/WebProcess/GPU/graphics/Model/RemoteMeshProxy.cpp:
(WebKit::RemoteMeshProxy::paintCurrentFrameToImageBuffer):
* Source/WebKit/WebProcess/GPU/graphics/Model/RemoteMeshProxy.h:
(WebKit::RemoteMeshProxy::sendSync):
* Source/WebKit/WebProcess/Model/Mesh.h:
* Source/WebKit/WebProcess/Model/WebModelPlayer.h:
* Source/WebKit/WebProcess/Model/WebModelPlayer.mm:
(WebKit::WebModelPlayer::load):
(WebKit::WebModelPlayer::sizeDidChange):
(WebKit::WebModelPlayer::snapshotCurrentFrame):
(WebKit::WebModelPlayer::render):
(WebKit::WebModelPlayer::visibilityStateDidChange):

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



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

Reply via email to