[webkit-changes] [WebKit/WebKit] e4c57c: OffscreenCanvas::transferToImageBitmap doesn't enf...

mattwoodrow noreply at github.com
Wed Feb 8 14:16:12 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e4c57c810933fe6b9d74013303d92b3484b62f33
      https://github.com/WebKit/WebKit/commit/e4c57c810933fe6b9d74013303d92b3484b62f33
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    M LayoutTests/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt
    A LayoutTests/platform/ios/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt
    R LayoutTests/platform/mac-wk1/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp

  Log Message:
  -----------
  OffscreenCanvas::transferToImageBitmap doesn't enforce size restrictions
https://bugs.webkit.org/show_bug.cgi?id=251130

Reviewed by Chris Lord.

We share code with HTMLCanvasElement via CanvasBase for allocating the backing store, with max size restrictions.

transferToImageBitmap can sometimes allocate a new buffer (if there isn't one already), and it currently isn't using the same code, so doesn't have the same restrictions.

This makes CanvasBase::createImageBuffer return the allocated buffer so that we can use it for transferToImageBitmap and get identical behaviour between code paths.

* LayoutTests/platform/ios/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt: Added.
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::buffer const):
(WebCore::CanvasBase::allocateImageBuffer const):
(WebCore::CanvasBase::createImageBuffer const): Deleted.
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase::createImageBuffer const):
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createImageBuffer const):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::transferToImageBitmap):
(WebCore::OffscreenCanvas::createImageBuffer const):
* Source/WebCore/html/OffscreenCanvas.h:

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




More information about the webkit-changes mailing list