diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-03-05 11:01:48 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-05 18:25:59 +0000 |
commit | fe6b82b01c846f44bc2024e44f740cca187a3f0d (patch) | |
tree | d14fd08c6288388bde241d407f8af5db6b0999ae /Userland/Libraries/LibWeb/WebGL | |
parent | cec1cda8b0eccc9e4d6b500f233eabcb2d69d010 (diff) | |
download | serenity-fe6b82b01c846f44bc2024e44f740cca187a3f0d.zip |
LibWeb: Port WebGLContextEvent to new String
Diffstat (limited to 'Userland/Libraries/LibWeb/WebGL')
4 files changed, 13 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp index 3d416284d0..8e8fddcda1 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp @@ -9,18 +9,18 @@ namespace Web::WebGL { -WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WebGLContextEventInit const& event_init) +WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::create(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init) { return MUST_OR_THROW_OOM(realm.heap().allocate<WebGLContextEvent>(realm, realm, event_name, event_init)); } -WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, WebGLContextEventInit const& event_init) +WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init) { return create(realm, event_name, event_init); } -WebGLContextEvent::WebGLContextEvent(JS::Realm& realm, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init) - : DOM::Event(realm, type, event_init) +WebGLContextEvent::WebGLContextEvent(JS::Realm& realm, FlyString const& type, WebGLContextEventInit const& event_init) + : DOM::Event(realm, type.to_deprecated_fly_string(), event_init) , m_status_message(event_init.status_message) { } diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h index 71b2bd6294..28d0dd584e 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h @@ -7,31 +7,32 @@ #pragma once +#include <AK/FlyString.h> #include <LibWeb/DOM/Event.h> namespace Web::WebGL { struct WebGLContextEventInit final : public DOM::EventInit { - DeprecatedString status_message { DeprecatedString::empty() }; + String status_message; }; class WebGLContextEvent final : public DOM::Event { WEB_PLATFORM_OBJECT(WebGLContextEvent, DOM::Event); public: - static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> create(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init); - static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init); + static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> create(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init); + static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init); virtual ~WebGLContextEvent() override; - DeprecatedString const& status_message() const { return m_status_message; } + String const& status_message() const { return m_status_message; } private: - WebGLContextEvent(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init); + WebGLContextEvent(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init); virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; - DeprecatedString m_status_message { DeprecatedString::empty() }; + String m_status_message; }; } diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl index 5104d69396..fc1493c2c4 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl +++ b/Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl @@ -1,6 +1,6 @@ #import <DOM/Event.idl> -[Exposed=(Window,Worker)] +[Exposed=(Window,Worker), UseNewAKString] interface WebGLContextEvent : Event { constructor(DOMString type, optional WebGLContextEventInit eventInit = {}); readonly attribute DOMString statusMessage; diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp index 7b66b95678..2fe1880382 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp @@ -17,7 +17,7 @@ static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, De { // 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. - auto event = WebGLContextEvent::create(canvas_element.realm(), type, WebGLContextEventInit {}).release_value_but_fixme_should_propagate_errors(); + 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(); event->set_is_trusted(true); event->set_cancelable(true); canvas_element.dispatch_event(*event); |