[webkit-changes] [WebKit/WebKit] 8edd62: Introduce a new platform layer type for Separated ...

Etienne Segonzac noreply at github.com
Wed Dec 18 08:17:43 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8edd622a31cf499a31cfb2958ae7f23aeca8a5ad
      https://github.com/WebKit/WebKit/commit/8edd622a31cf499a31cfb2958ae7f23aeca8a5ad
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2024-12-18 (Wed, 18 Dec 2024)

  Changed paths:
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade-content-expected.txt
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade-content.html
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade-expected.txt
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade-tiled-expected.txt
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade-tiled.html
    A LayoutTests/platform/visionos/transforms/separated-image-downgrade.html
    A LayoutTests/platform/visionos/transforms/separated-image-upgrade-expected.txt
    A LayoutTests/platform/visionos/transforms/separated-image-upgrade-tiled-expected.txt
    A LayoutTests/platform/visionos/transforms/separated-image-upgrade-tiled.html
    A LayoutTests/platform/visionos/transforms/separated-image-upgrade.html
    M Source/WebCore/platform/graphics/GraphicsLayer.cpp
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebKit/Configurations/WebKit.xcconfig
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources-output.xcfilelist
    M Source/WebKit/DerivedSources.make
    A Source/WebKit/Shared/API/Cocoa/WKRemoteLayerTreeViewProtocols.h
    M Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h
    M Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.serialization.in
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
    M Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm
    A Source/WebKit/UIProcess/Cocoa/WKSeparatedImageView.h
    A Source/WebKit/UIProcess/Cocoa/WKSeparatedImageView.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  Introduce a new platform layer type for Separated Images
https://bugs.webkit.org/show_bug.cgi?id=283721
<rdar://137133500>

Reviewed by Simon Fraser.

Initially keyed on the `separated` transform style, and behind a
configuration flag, this patch introduces a new platformLayer Type
/ Custom View for Separated Images.

This view uses takes the layer's backing store IOSurface. And this
behavior is currently only enabled for images below the dimension
thresholds triggering tiling.

* Source/WebCore/platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::isSeparatedImage const):
(WebCore::GraphicsLayer::setIsSeparatedImage):
New method to flag a graphics layer as a Separated Image.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setIsSeparatedImage):
Flag the graphics layer as a SepratedImage, will impact layer type.
(WebCore::GraphicsLayerCA::commitLayerTypeChangesBeforeSublayers):
Change the platform layer type for separated images.
(WebCore::GraphicsLayerCA::changeLayerTypeTo):
Make sure Separated flag and clipping strategy are not lost when
changing layer type.

* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm:
(WebCore::operator<<):
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::description const):
Introduce new platform Layer Type for Separated Images.

* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateSeparatedProperties):
Introduce a new method to update properties related to the Separated
transform style.
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::updateGeometry):
(WebCore::RenderLayerBacking::contentChanged):
Update Separated properties as part of the configuration update or when
the Image content changes.

* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStyleChanged):
Flag the layer as needing a compositing configuration change when the
Separated transform-style is updated.

* Source/WebKit/Configurations/WebKit.xcconfig:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources-output.xcfilelist:
* Source/WebKit/DerivedSources.make:
WKA entry for the WKSeparatedImageView.

* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::drawInContext):
(WebKit::RemoteLayerBackingStoreProperties::applyBackingStoreToLayer):
Add a custom backing store application method for WKSeparatedImageViews,
passing the IOSurface to the view.

* Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h:
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
* Source/WebKit/Shared/API/Cocoa/WKRemoteLayerTreeViewProtocols.h: Added.
Expose the WKContentControlled protocol to Swift.

* Source/WebKit/UIProcess/Cocoa/WKSeparatedImageView.h: Added.
* Source/WebKit/UIProcess/Cocoa/WKSeparatedImageView.mm: Added.
(-[WKSeparatedImageView init]):
(-[WKSeparatedImageView initWithFrame:]):
(-[WKSeparatedImageView initWithCoder:]):
(-[WKSeparatedImageView setSurface:]):
Stub implementation for public SDK builds.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Instantiate a custom view, WKSeparatedImageView for the Separated Image
Layer Type.

* Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm:
(allowListedClassToString):
(shouldDumpSeparatedDetails):
(dumpUIView):
Adjust the content of the text dump to get a reliable tests without
dynamic IDs. Dump layer corner radius for UIViews too.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade-content-expected.txt: Added.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade-content.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade-expected.txt: Added.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade-tiled-expected.txt: Added.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade-tiled.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image-downgrade.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image-upgrade-expected.txt: Added.
* LayoutTests/platform/visionos/transforms/separated-image-upgrade-tiled-expected.txt: Added.
* LayoutTests/platform/visionos/transforms/separated-image-upgrade-tiled.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image-upgrade.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image.html: Added.
* LayoutTests/platform/visionos/transforms/separated-image-expected.txt: Added.
Add new UIView-based tests covering upgrading to and downgrading from a
Separated Image platform layer based on style, size and content changes.
They also cover cases where we don't use the `WKSeparatedImageView` for
layers using tiling.

Canonical link: https://commits.webkit.org/288011@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