Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ffc262655569c23329f4aba000ba069cbe4b0e9b
      
https://github.com/WebKit/WebKit/commit/ffc262655569c23329f4aba000ba069cbe4b0e9b
  Author: Kimmo Kinnunen <[email protected]>
  Date:   2026-10-12 (Mon, 12 Oct 2026)

  Changed paths:
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/HTMLCanvasElement.h
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/coordinated/GraphicsLayerCoordinated.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerBacking.h
    M Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp
    M Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.h

  Log Message:
  -----------
  HTMLCanvasElement::usesContentsAsLayerContents() should check the layer, not 
predict it
https://bugs.webkit.org/show_bug.cgi?id=326792
rdar://problem/189498920

Reviewed by Taher Ali.

HTMLCanvasElement::usesContentsAsLayerContents() returned true when
accelerated compositing was enabled for the view and the rendering
context delegates display. That predicts what compositing will do; it
does not say whether the canvas layer shows the context's display
delegate. The two differ before the first compositing update after a
context is created, and when the context gives the layer a null
delegate. In those cases paint() drew nothing and willUpdateContents()
sent the update to a backing that did not exist or did not display the
canvas.

Add GraphicsLayer::hasContentsDisplayDelegate(), which reports whether a
contents display delegate is installed, regardless of what installed it
(canvas, OffscreenCanvas placeholder, model). GraphicsLayerCA and
GraphicsLayerCoordinated already store the delegate. GraphicsLayerWC
turns the delegate into a platform layer, so it now tracks whether its
platform layer came from a delegate.
RenderLayerBacking::hasContentsDisplayDelegate() forwards to the primary
graphics layer, and usesContentsAsLayerContents() now asks the canvas's
backing.

Also inline computeDirtyRectangleIfNeeded() into its only caller,
willUpdateContents(), so usesContentsAsLayerContents() is evaluated
once.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::willUpdateContents):
(WebCore::HTMLCanvasElement::usesContentsAsLayerContents const):
(WebCore::HTMLCanvasElement::computeDirtyRectangleIfNeeded const): Deleted.
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::hasContentsDisplayDelegate const):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/coordinated/GraphicsLayerCoordinated.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::hasContentsDisplayDelegate const):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp:
(WebKit::GraphicsLayerWC::setContentsToPlatformLayer):
(WebKit::GraphicsLayerWC::setContentsDisplayDelegate):
* Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.h:

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



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

Reply via email to