Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a8a0b96619f38d1a9cb165fd57e25c27cee2ef7b
      
https://github.com/WebKit/WebKit/commit/a8a0b96619f38d1a9cb165fd57e25c27cee2ef7b
  Author: Cameron McCormack <[email protected]>
  Date:   2026-08-31 (Mon, 31 Aug 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp

  Log Message:
  -----------
  Return transparent black for a placeholder canvas that has no pushed frame
https://bugs.webkit.org/show_bug.cgi?id=322961
rdar://186229685

Reviewed by Said Abou-Hallawa.

CanvasBase::makeRenderingResultsAvailable fabricates a transparent black bitmap
only when a canvas has no rendering context. A placeholder canvas has an 
internal
PlaceholderRenderingContext, so it took the context path instead, and that
returned nullptr until the OffscreenCanvas pushed its first frame. ImageBitmap
turned the null into "Cannot create ImageBitmap from canvas that can't be
rendered", which rejected the promise and timed out two subtests.

HTML's usability check makes an HTMLCanvasElement source bad only when a
dimension is zero, so a sized placeholder with no pushed frame is good and must
produce a transparent black bitmap. PlaceholderRenderingContext already reports
isSurfaceBufferTransparentBlack() when it has no buffer, so the class modelled
this correctly for painting and simply did not apply it when asked for a buffer.
createPattern, toDataURL, toBlob and toVideoFrame reach the same path.

* LayoutTests/TestExpectations:
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::makeRenderingResultsAvailable):
(WebCore::CanvasBase::createTransparentBlackImageBuffer const):
* Source/WebCore/html/CanvasBase.h:
* Source/WebCore/html/canvas/PlaceholderRenderingContext.cpp:
(WebCore::PlaceholderRenderingContext::surfaceBufferToImageBuffer):

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



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

Reply via email to