[webkit-changes] [WebKit/WebKit] d21c61: OffscreenCanvas should use the same buffer size ch...

mattwoodrow noreply at github.com
Thu Dec 22 01:00:40 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d21c61e18c6ffba8cae41d4e35630351c4d1945a
      https://github.com/WebKit/WebKit/commit/d21c61e18c6ffba8cae41d4e35630351c4d1945a
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2022-12-22 (Thu, 22 Dec 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/html/HTMLCanvasElement.h
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/testing/Internals.cpp

  Log Message:
  -----------
  OffscreenCanvas should use the same buffer size checks as HTMLCanvasElement.
https://bugs.webkit.org/show_bug.cgi?id=249630
<rdar://103177223>

Reviewed by Dean Jackson.

HTMLCanvasElement has a lot of checks to determine if the specified size is within an acceptable range, whereas OffscreenCanvas will just allocate giant buffers if requested.
This moves the HTMLCanvasElement implementation of createImageBuffer into CanvasBase, so that it can be used by OffscreenCanvas and have consistent behaviour.

* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::maxActivePixelMemory):
(WebCore::CanvasBase::setMaxPixelMemoryForTesting):
(WebCore::maxCanvasArea):
(WebCore::CanvasBase::setMaxCanvasAreaForTesting):
(WebCore::CanvasBase::graphicsClient const):
(WebCore::CanvasBase::shouldAccelerate const):
(WebCore::CanvasBase::createImageBuffer const):
* Source/WebCore/html/CanvasBase.h:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createImageBuffer const):
(WebCore::HTMLCanvasElement::maxActivePixelMemory): Deleted.
(WebCore::HTMLCanvasElement::setMaxPixelMemoryForTesting): Deleted.
(WebCore::maxCanvasArea): Deleted.
(WebCore::HTMLCanvasElement::setMaxCanvasAreaForTesting): Deleted.
(WebCore::HTMLCanvasElement::shouldAccelerate const): Deleted.
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::createImageBuffer const):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::maybeRestoreContext):
(WebCore::getGraphicsClient): Deleted.
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setMaxCanvasPixelMemory):
(WebCore::Internals::setMaxCanvasArea):
(WebCore::Internals::avoidIOSurfaceSizeCheckInWebProcess):

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




More information about the webkit-changes mailing list