[webkit-changes] [WebKit/WebKit] d71f4e: OffscreenCanvas rendering can hide the border from...

mattwoodrow noreply at github.com
Fri May 5 12:38:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d71f4ec5052b4d57ddd2e046b22f0556cbce5704
      https://github.com/WebKit/WebKit/commit/d71f4ec5052b4d57ddd2e046b22f0556cbce5704
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-05-05 (Fri, 05 May 2023)

  Changed paths:
    A LayoutTests/fast/canvas/offscreen-backing-store-attached-expected.html
    A LayoutTests/fast/canvas/offscreen-backing-store-attached.html
    A LayoutTests/fast/canvas/offscreen-border-expected.html
    A LayoutTests/fast/canvas/offscreen-border.html
    A LayoutTests/fast/canvas/offscreen-clipped-expected.html
    A LayoutTests/fast/canvas/offscreen-clipped.html
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm
    M Source/WebCore/platform/graphics/GraphicsLayerContentsDisplayDelegate.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
    M Source/WebCore/platform/graphics/ca/PlatformCALayerDelegatedContents.h
    M Source/WebCore/platform/graphics/ca/cocoa/GraphicsLayerAsyncContentsDisplayDelegateCocoa.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
    R Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp
    A Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollbarsController.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollbarsController.mm

  Log Message:
  -----------
  OffscreenCanvas rendering can hide the border from the element.
https://bugs.webkit.org/show_bug.cgi?id=254493

Reviewed by Simon Fraser.

This initializes the 'contents layer' of GraphicsLayerCA so that the canvas buffer is presented
as a separate layer on top of the primary layer containing the border.

In order to prevent the main thread from changing/removing the contents of this platform layer, it
changes the async display delegate to extend the normal display delegate, so that the output buffer
of OffscreenCanvas is provided to the layer both on the main-thread as well as asynchronously sending
it to the UI-side compositor.

Since we potentially have a race with this, where the main-thread RemoteLayerTransaction might send a buffer
that is a frame behind the one most recently provided asynchronously, it also adds tracking of the RenderingResourceIdentifiers,
and skips the main-thread buffer update if we have a newer one from the async path.

This also exposed another bug, where if we sent a buffer asynchronously for a layer that didn't have a backing
store (due to being offscreen), it would get lost. If the layer then moved onscreen, we'd wouldn't have the contents (until
the page drew to the OffscreenCanvas again).

* LayoutTests/fast/canvas/offscreen-backing-store-attached-expected.html: Added.
* LayoutTests/fast/canvas/offscreen-backing-store-attached.html: Added.

New test for the case where the canvas doesn't have a backing store at the time offscreen canvas sends a buffer, but has
a backing store later.

* LayoutTests/fast/canvas/offscreen-border-expected.html: Added.
* LayoutTests/fast/canvas/offscreen-border.html: Added.

Test for offscreen canvas and a border on the same element.

* LayoutTests/fast/canvas/offscreen-clipped-expected.html: Added.
* LayoutTests/fast/canvas/offscreen-clipped.html: Added.

Test for offscreen canvas and clip path, to ensure clipping of the 'contents layer' works correctly.

* Source/WebCore/platform/graphics/GraphicsLayerContentsDisplayDelegate.h:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToAsyncDisplayDelegate):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/cocoa/GraphicsLayerAsyncContentsDisplayDelegateCocoa.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::setContents):
(WebKit::RemoteLayerBackingStoreProperties::applyBackingStoreToLayer):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::asyncSetLayerContents):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::asyncSetLayerContents):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
(WebKit::RemoteLayerTreeNode::asyncContentsIdentifier const):
(WebKit::RemoteLayerTreeNode::setAsyncContentsIdentifier):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
(WebKit::GraphicsLayerCARemoteAsyncContentsDisplayDelegate::GraphicsLayerCARemoteAsyncContentsDisplayDelegate):
(WebKit::GraphicsLayerCARemoteAsyncContentsDisplayDelegate::setDestinationLayerID):
(WebKit::GraphicsLayerCARemote::createAsyncContentsDisplayDelegate):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setContents):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:

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




More information about the webkit-changes mailing list