Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 27dac32ecc9c989f5d4cd702baba2db6fc23fdde
      
https://github.com/WebKit/WebKit/commit/27dac32ecc9c989f5d4cd702baba2db6fc23fdde
  Author: Kimmo Kinnunen <kkinnu...@apple.com>
  Date:   2023-11-01 (Wed, 01 Nov 2023)

  Changed paths:
    M Source/WebCore/Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext.h
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.h
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/inspector/InspectorCanvas.cpp

  Log Message:
  -----------
  WebGLRenderingContextBase preventBufferClearForInspector is redundant
https://bugs.webkit.org/show_bug.cgi?id=263885
rdar://117684773

Reviewed by Dan Glastonbury.

WebGLRenderingContextBase::setPreventBufferClearForInspector
was intended to make sure that inspector reading the WebGL rendering
would not force the pending drawing buffer clear. The read happens
with toDataURL, which generally used to read drawing buffer, not
compositing buffer.

This was a workaround for case where the read would happen after
prepareForDisplay. However, preventing the clear is incorrect, as
there is nothing correct to be read from the uncleared back buffer.
That buffer may contain contents from two frames back or it might
be a brand new buffer.

Instead, make it explicit that the transfer to the rendering results
happens from display buffer if there is no draws in drawing
buffer. Otherwise use the drawing buffer.

Remove the redundant m_isDisplayingWithPaint, instead prepare
the display buffer during paint, if it is not already prepared. Normal
layer paint happens after document-wide preparation during rendering
update. Snapshots paint or print may happen without preparation, so
the HTMLCanvasElement::paint will prepare the display buffer.

Removes the canvas reading taint check logic from Web Inspector capture.
The capture should always work, as it is trusted. Each individual
draw commands will be captured differently, and there the result
data reflects what the target canvas receives, taint logic included.

* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::commitToPlaceholderCanvas):
* Source/WebCore/html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::prepareForDisplayWithPaint): Deleted.
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.h:
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm:
(WebCore::GPUCanvasContextCocoa::prepareForDisplayWithPaint): Deleted.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::initializeContextState):
(WebCore::WebGLRenderingContextBase::markContextChanged):
(WebCore::WebGLRenderingContextBase::clearIfComposited):
(WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
(WebCore::WebGLRenderingContextBase::prepareForDisplayWithPaint): Deleted.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::preventBufferClearForInspector const): 
Deleted.
(WebCore::WebGLRenderingContextBase::setPreventBufferClearForInspector): 
Deleted.
* Source/WebCore/inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::getContentAsDataURL):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to