Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bb3a385acc43ab1cf1eda4b92426891fd130deef
      
https://github.com/WebKit/WebKit/commit/bb3a385acc43ab1cf1eda4b92426891fd130deef
  Author: Robert Jenner <[email protected]>
  Date:   2026-03-20 (Fri, 20 Mar 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/cocoa/PhotosFormatSoftLink.mm
    M Source/WebCore/platform/graphics/BitmapImage.h
    M Source/WebCore/platform/graphics/BitmapImageDescriptor.cpp
    M Source/WebCore/platform/graphics/BitmapImageDescriptor.h
    M Source/WebCore/platform/graphics/BitmapImageSource.cpp
    M Source/WebCore/platform/graphics/BitmapImageSource.h
    M Source/WebCore/platform/graphics/Image.h
    M Source/WebCore/platform/graphics/ImageDecoder.h
    M Source/WebCore/platform/graphics/ImageSource.h
    M Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
    M Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
    A Source/WebCore/platform/graphics/cg/ShareableSpatialImage.cpp
    A Source/WebCore/platform/graphics/cg/ShareableSpatialImage.h
    A Source/WebCore/platform/graphics/cg/SpatialImageTypes.h
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/FullScreenMediaDetails.h
    M Source/WebKit/Shared/FullScreenMediaDetails.serialization.in
    A Source/WebKit/Shared/ShareableSpatialImage.serialization.in
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp
    M Source/WebKit/UIProcess/WebFullScreenManagerProxy.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/cg/ShareableSpatialImageTests.mm
    A Tools/TestWebKitAPI/Tests/WebCore/cg/spatial.heic

  Log Message:
  -----------
  Use ShareableBitmaps for the QuickLook fullscreen message
<rdar://140581661>

Reviewed by Aditya Keerthi and Simon Fraser.

When entering QuickLook fullscreen, instead of sending over the resource
buffer directly from WebContent to the UIProcess (and then QuickLook),
use ShareableBitmaps and reconstruct a HEIC file on the UI side.

This feature is used for both panoramic images (mono images with
specific dimensions) and Spatial Images (stereo).
To handle the Spatial case we introduce a new `ShareableSpatialImage`
type using ShareableBitmaps to transfer the underlying image data and
CoreIPC inspectable types to represent the Spatial metadata.

Tests: Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
       Tools/TestWebKitAPI/Tests/WebCore/cg/ShareableSpatialImageTests.mm
       Tools/TestWebKitAPI/Tests/WebCore/cg/spatial.heic

* Source/WebCore/Headers.cmake:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Reference new ShareableSpatialImage files.

* Source/WebCore/platform/cocoa/PhotosFormatSoftLink.mm:
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/BitmapImageDescriptor.cpp:
(WebCore::BitmapImageDescriptor::shouldUseQuickLookForFullscreen const): 
Deleted.
* Source/WebCore/platform/graphics/BitmapImageDescriptor.h:
* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::spatialLeftEyeFrameIndex const):
(WebCore::BitmapImageSource::spatialRightEyeFrameIndex const):
(WebCore::BitmapImageSource::spatialEyePropertiesAtIndex const):
* Source/WebCore/platform/graphics/BitmapImageSource.h:
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::shouldUseQuickLookForFullscreen const): Deleted.
* Source/WebCore/platform/graphics/ImageDecoder.h:
(WebCore::ImageDecoder::spatialLeftEyeFrameIndex const):
(WebCore::ImageDecoder::spatialRightEyeFrameIndex const):
(WebCore::ImageDecoder::spatialEyePropertiesAtIndex const):
(WebCore::ImageDecoder::shouldUseQuickLookForFullscreen const): Deleted.
* Source/WebCore/platform/graphics/ImageSource.h:
(WebCore::ImageSource::spatialLeftEyeFrameIndex const):
(WebCore::ImageSource::spatialRightEyeFrameIndex const):
(WebCore::ImageSource::spatialEyePropertiesAtIndex const):
(WebCore::ImageSource::shouldUseQuickLookForFullscreen const): Deleted.
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoderCG::isSpatial const):
(WebCore::ImageDecoderCG::spatialEyeFrameIndex const):
(WebCore::ImageDecoderCG::spatialLeftEyeFrameIndex const):
(WebCore::ImageDecoderCG::spatialRightEyeFrameIndex const):
(WebCore::spatialImageEyePropertiesFromDictionary):
(WebCore::ImageDecoderCG::spatialEyePropertiesAtIndex const):
(WebCore::ImageDecoderCG::shouldUseQuickLookForFullscreen const):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.h:
Introduce new methods to extract the left eye / right eye indices and
metadata for Spatial Images. These are gated by the `isSpatial()` check
as part of the `ENABLE(SPATIAL_IMAGE_DETECTION)` ifdef.
Remove `shouldUseQuickLookForFullscreen` (now inlined).

* Source/WebCore/platform/graphics/cg/ShareableSpatialImage.h: Added.
* Source/WebCore/platform/graphics/cg/SpatialImageTypes.h: Added.
* Source/WebCore/platform/graphics/cg/ShareableSpatialImage.cpp: Added.
(WebCore::spatialImageEyePropertiesToDictionary):
(WebCore::ShareableSpatialImage::ShareableSpatialImage):
(WebCore::ShareableSpatialImage::create):
Use the new spatial methods to construct a ShareableSpatialImage:
- find the indices for left eye / right eye
- fetch their spatial metadata
- get the corresponding frames
(WebCore::ShareableSpatialImage::createHEICData const):
Re-construct a HEIC file from a ShareableSpatialImage. This is what we
send to QuickLook.

* Source/WebKit/Shared/ShareableSpatialImage.serialization.in: Added.
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Scripts/webkit/messages.py:
(types_that_must_be_moved):
Add the new IPC message and types for ShareableSpatialImages.

* Source/WebKit/Shared/FullScreenMediaDetails.h:
* Source/WebKit/Shared/FullScreenMediaDetails.serialization.in:
Update the FullScreenMediaDetails message to use a variant for the image
data:
- nothing (video use case)
- mono image (simple ShareableBitmap)
- stereo image (the new ShareableSpatialImage)
This field is only present when we `ENABLE(QUICKLOOK_FULLSCREEN)` on
visionOS.

* Source/WebKit/UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::enterFullScreen):
(WebKit::WebFullScreenManagerProxy::updateImageSource):
(WebKit::WebFullScreenManagerProxy::exitFullScreen):
(WebKit::WebFullScreenManagerProxy::prepareQuickLookImageURL const):
* Source/WebKit/UIProcess/WebFullScreenManagerProxy.h:
(WebKit::WebFullScreenManagerProxy::isImageElement const):
Re-construct a HEIC from the ShareableBitmap/ShareableSpatialImage to
send to QuickLook, with the same temporary file mechanism.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::getImageMediaDetails):
Use ShareableBitmap / ShareableSpatialImage instead of sending the
resource buffer. Use `createFromImageDraw` for non-spatial (panoramic)
images.
Inline the old `shouldUseQuickLookForFullscreen` check.

* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/cg/ShareableSpatialImageTests.mm: Added.
(TestWebKitAPI::TEST(ShareableSpatialImageTests, SpatialImageRoundTrip)):
* Tools/TestWebKitAPI/Tests/WebCore/cg/spatial.heic: Added.
Introduce a ShareableSpatialImage test suite.

Originally-landed-as: 301765.352@safari-7623-branch (39d4c256bfce). 
rdar://171559593
Canonical link: https://commits.webkit.org/309670@main



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

Reply via email to