mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 20:57:41 +00:00
LibWeb: Port fire_webgl_context_event() to new FlyString
This commit is contained in:
parent
fb96966f1e
commit
d39ac0a0ed
1 changed files with 4 additions and 3 deletions
|
@ -7,17 +7,18 @@
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
||||||
|
#include <LibWeb/WebGL/EventNames.h>
|
||||||
#include <LibWeb/WebGL/WebGLContextEvent.h>
|
#include <LibWeb/WebGL/WebGLContextEvent.h>
|
||||||
#include <LibWeb/WebGL/WebGLRenderingContext.h>
|
#include <LibWeb/WebGL/WebGLRenderingContext.h>
|
||||||
|
|
||||||
namespace Web::WebGL {
|
namespace Web::WebGL {
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#fire-a-webgl-context-event
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#fire-a-webgl-context-event
|
||||||
static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, DeprecatedFlyString const& type)
|
static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, FlyString const& type)
|
||||||
{
|
{
|
||||||
// To fire a WebGL context event named e means that an event using the WebGLContextEvent interface, with its type attribute [DOM4] initialized to e, its cancelable attribute initialized to true, and its isTrusted attribute [DOM4] initialized to true, is to be dispatched at the given object.
|
// To fire a WebGL context event named e means that an event using the WebGLContextEvent interface, with its type attribute [DOM4] initialized to e, its cancelable attribute initialized to true, and its isTrusted attribute [DOM4] initialized to true, is to be dispatched at the given object.
|
||||||
// FIXME: Consider setting a status message.
|
// FIXME: Consider setting a status message.
|
||||||
auto event = WebGLContextEvent::create(canvas_element.realm(), String::from_deprecated_string(type).release_value_but_fixme_should_propagate_errors(), WebGLContextEventInit {}).release_value_but_fixme_should_propagate_errors();
|
auto event = WebGLContextEvent::create(canvas_element.realm(), type, WebGLContextEventInit {}).release_value_but_fixme_should_propagate_errors();
|
||||||
event->set_is_trusted(true);
|
event->set_is_trusted(true);
|
||||||
event->set_cancelable(true);
|
event->set_cancelable(true);
|
||||||
canvas_element.dispatch_event(*event);
|
canvas_element.dispatch_event(*event);
|
||||||
|
@ -27,7 +28,7 @@ static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, De
|
||||||
static void fire_webgl_context_creation_error(HTML::HTMLCanvasElement& canvas_element)
|
static void fire_webgl_context_creation_error(HTML::HTMLCanvasElement& canvas_element)
|
||||||
{
|
{
|
||||||
// 1. Fire a WebGL context event named "webglcontextcreationerror" at canvas, optionally with its statusMessage attribute set to a platform dependent string about the nature of the failure.
|
// 1. Fire a WebGL context event named "webglcontextcreationerror" at canvas, optionally with its statusMessage attribute set to a platform dependent string about the nature of the failure.
|
||||||
fire_webgl_context_event(canvas_element, "webglcontextcreationerror"sv);
|
fire_webgl_context_event(canvas_element, EventNames::webglcontextcreationerror);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::ThrowCompletionOr<JS::GCPtr<WebGLRenderingContext>> WebGLRenderingContext::create(JS::Realm& realm, HTML::HTMLCanvasElement& canvas_element, JS::Value options)
|
JS::ThrowCompletionOr<JS::GCPtr<WebGLRenderingContext>> WebGLRenderingContext::create(JS::Realm& realm, HTML::HTMLCanvasElement& canvas_element, JS::Value options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue