Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: abc23583c3fded932dce57b3a4cdfa547d771464
      
https://github.com/WebKit/WebKit/commit/abc23583c3fded932dce57b3a4cdfa547d771464
  Author: Kimmo Kinnunen <kkinnu...@apple.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M Source/WebCore/html/ImageData.cpp
    M Source/WebCore/html/ImageData.h
    M Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h
    M Source/WebCore/platform/graphics/ByteArrayPixelBuffer.cpp
    M Source/WebCore/platform/graphics/PixelBuffer.cpp
    M Source/WebCore/platform/graphics/PixelBuffer.h
    M Source/WebKit/GPUProcess/graphics/ShareablePixelBuffer.cpp

  Log Message:
  -----------
  2D context get/putImageData cache should be aware of empty contents
https://bugs.webkit.org/show_bug.cgi?id=264930
rdar://118499949

Reviewed by Cameron McCormack.

Avoid real ImageBuffer::getPixelBuffer when getImageData is called
for a new 2D context. Track the transparent contents state and
just return zero filled ImageData buffer.

Hardens ImageData to ensure the data buffer is not created too big.
The buffer size is limited with PixelBuffer max size.
This would be caught with test
fast/canvas/canvas-getImageData-invalid-result-buffer-crash.html

Fixes a bug where CG path of text drawing would not mark the canvas
as modified. This would be caught with test
fast/canvas/gradient-text-with-shadow.html

Fixes a bug where focus drawing would not mark the canvas as modified.
This would be caught with test
fast/canvas/draw-focus-if-needed-with-path.html
fast/canvas/draw-focus-if-needed.html

* Source/WebCore/html/ImageData.cpp:
(WebCore::ImageData::create):
* Source/WebCore/html/ImageData.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::reset):
(WebCore::CanvasRenderingContext2DBase::didDraw):
(WebCore::CanvasRenderingContext2DBase::evictCachedImageData):
(WebCore::CanvasRenderingContext2DBase::CachedContentsImageData::CachedContentsImageData):
(WebCore::CanvasRenderingContext2DBase::cacheImageDataIfPossible):
(WebCore::CanvasRenderingContext2DBase::makeImageDataIfContentsCached const):
(WebCore::CanvasRenderingContext2DBase::getImageData const):
(WebCore::CanvasRenderingContext2DBase::putImageData):
(WebCore::CanvasRenderingContext2DBase::CachedImageData::CachedImageData): 
Deleted.
(WebCore::CanvasRenderingContext2DBase::takeCachedImageDataIfPossible const): 
Deleted.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h:

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


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

Reply via email to