mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibWeb: Create canvas bitmap when not existing in toDataURL and toBlob
This commit is contained in:
parent
d24e07579f
commit
5e7a82a853
5 changed files with 34 additions and 3 deletions
|
@ -246,8 +246,12 @@ static ErrorOr<SerializeBitmapResult> serialize_bitmap(Gfx::Bitmap const& bitmap
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-todataurl
|
||||
String HTMLCanvasElement::to_data_url(StringView type, Optional<double> quality) const
|
||||
String HTMLCanvasElement::to_data_url(StringView type, Optional<double> quality)
|
||||
{
|
||||
// It is possible the the canvas doesn't have a associated bitmap so create one
|
||||
if (!bitmap())
|
||||
create_bitmap();
|
||||
|
||||
// FIXME: 1. If this canvas element's bitmap's origin-clean flag is set to false, then throw a "SecurityError" DOMException.
|
||||
|
||||
// 2. If this canvas element's bitmap has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero)
|
||||
|
@ -275,6 +279,10 @@ String HTMLCanvasElement::to_data_url(StringView type, Optional<double> quality)
|
|||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-toblob
|
||||
WebIDL::ExceptionOr<void> HTMLCanvasElement::to_blob(JS::NonnullGCPtr<WebIDL::CallbackType> callback, StringView type, Optional<double> quality)
|
||||
{
|
||||
// It is possible the the canvas doesn't have a associated bitmap so create one
|
||||
if (!bitmap())
|
||||
create_bitmap();
|
||||
|
||||
// FIXME: 1. If this canvas element's bitmap's origin-clean flag is set to false, then throw a "SecurityError" DOMException.
|
||||
|
||||
// 2. Let result be null.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue