[webkit-changes] [WebKit/WebKit] 26aaa2: REGRESSION(267824 at main): Changing HTMLCanvasElemen...

Kimmo Kinnunen noreply at github.com
Mon Feb 5 23:35:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 26aaa25dcbdc3f17bdf4ebd4067a160adb9e1cad
      https://github.com/WebKit/WebKit/commit/26aaa25dcbdc3f17bdf4ebd4067a160adb9e1cad
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-02-05 (Mon, 05 Feb 2024)

  Changed paths:
    M LayoutTests/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt
    M LayoutTests/platform/ios/fast/canvas/offscreen-giant-transfer-to-imagebitmap-expected.txt
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

  Log Message:
  -----------
  REGRESSION(267824 at main): Changing HTMLCanvasElement width, height causes intermediate buffer allocations
https://bugs.webkit.org/show_bug.cgi?id=268745
rdar://122309325

Reviewed by Simon Fraser.

Resizing is intended to leave the buffer unallocated, so that
sequential width, height assignments will not allocate multiple times.

This intention was nullified by CanvasRenderingContext2DBase::reset().
Calling resetTransform redundantly would recreate the buffer
immediately from width, height attribute setters.

The transform reset is redundant, the context transform is reset when
the context state saver is restored and re-saved.

Clearing the canvas doesn't need to use public
CanvasRenderingContext2DBase::clearCanvas() that will mutate the context
state. The state is in known state with initial transform, and thus it
doesn't need transform mutation.

* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::reset):

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




More information about the webkit-changes mailing list