Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 567d1d7beea8fab8107ee44d5d3ba3723db4542a
      
https://github.com/WebKit/WebKit/commit/567d1d7beea8fab8107ee44d5d3ba3723db4542a
  Author: Kimmo Kinnunen <[email protected]>
  Date:   2025-10-27 (Mon, 27 Oct 2025)

  Changed paths:
    M Source/WebCore/dom/Document.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/OffscreenCanvas.h

  Log Message:
  -----------
  Simplify CanvasBase::setSize
https://bugs.webkit.org/show_bug.cgi?id=301343
rdar://163259339

Reviewed by Antti Koivisto.

CanvasBase::setSize() is used by OffscreenCanvas, HTMLCanvasElement as
common implementation to store the context size as requested by the
client. It does not really resize anything.

CanvasBase::setSize() was also a virtual function.

HTMLCanvasElement::setSize() overload was used to expose resize
operation to CSSCanvasContext feature (Document::getCSSCanvasContext).
This would resize the canvas.

The virtual function aspect was not used and created very unclear
control flows.

Fix by:
- Rename HTMLCanvasElement::setSize() to
  HTMLCanvasElement::setCSSCanvasContextSize().
- Remove redundant function HTMLCanvasELement::setSurfaceSize()
  "Surface" is not part of vocabularity of the related abstractions of
  the domain.
- Rename opaque HTMLCanvasElement::reset() to more descriptive
  HTMLCanvasELement::didUpdateSizeProperties().

This is work towards being able to move the backbuffer of various
canvas rendering contexts from CanvasBase to the rendering contexts.

* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::didUpdateSize):
(WebCore::CanvasBase::setSize): Deleted.
* Source/WebCore/html/CanvasBase.h:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::attributeChanged):
(WebCore::HTMLCanvasElement::setCSSCanvasContextSize):
(WebCore::HTMLCanvasElement::didUpdateSizeProperties):
(WebCore::HTMLCanvasElement::setSize): Deleted.
(WebCore::HTMLCanvasElement::reset): Deleted.
(WebCore::HTMLCanvasElement::setSurfaceSize): Deleted.
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::setWidth):
(WebCore::OffscreenCanvas::setHeight):
(WebCore::OffscreenCanvas::didUpdateSizeProperties):
(WebCore::OffscreenCanvas::setSize): Deleted.
(WebCore::OffscreenCanvas::reset): Deleted.
* Source/WebCore/html/OffscreenCanvas.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to