Browse Source

LibWeb: Port WebGLContextEvent to new String

Kenneth Myhra 2 years ago
parent
commit
fe6b82b01c

+ 4 - 4
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp

@@ -9,18 +9,18 @@
 
 
 namespace Web::WebGL {
 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));
     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);
     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)
     , m_status_message(event_init.status_message)
 {
 {
 }
 }

+ 7 - 6
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h

@@ -7,31 +7,32 @@
 
 
 #pragma once
 #pragma once
 
 
+#include <AK/FlyString.h>
 #include <LibWeb/DOM/Event.h>
 #include <LibWeb/DOM/Event.h>
 
 
 namespace Web::WebGL {
 namespace Web::WebGL {
 
 
 struct WebGLContextEventInit final : public DOM::EventInit {
 struct WebGLContextEventInit final : public DOM::EventInit {
-    DeprecatedString status_message { DeprecatedString::empty() };
+    String status_message;
 };
 };
 
 
 class WebGLContextEvent final : public DOM::Event {
 class WebGLContextEvent final : public DOM::Event {
     WEB_PLATFORM_OBJECT(WebGLContextEvent, DOM::Event);
     WEB_PLATFORM_OBJECT(WebGLContextEvent, DOM::Event);
 
 
 public:
 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;
     virtual ~WebGLContextEvent() override;
 
 
-    DeprecatedString const& status_message() const { return m_status_message; }
+    String const& status_message() const { return m_status_message; }
 
 
 private:
 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;
     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
 
 
-    DeprecatedString m_status_message { DeprecatedString::empty() };
+    String m_status_message;
 };
 };
 
 
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl

@@ -1,6 +1,6 @@
 #import <DOM/Event.idl>
 #import <DOM/Event.idl>
 
 
-[Exposed=(Window,Worker)]
+[Exposed=(Window,Worker), UseNewAKString]
 interface WebGLContextEvent : Event {
 interface WebGLContextEvent : Event {
     constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
     constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
     readonly attribute DOMString statusMessage;
     readonly attribute DOMString statusMessage;

+ 1 - 1
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.
     // 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(), 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_is_trusted(true);
     event->set_cancelable(true);
     event->set_cancelable(true);
     canvas_element.dispatch_event(*event);
     canvas_element.dispatch_event(*event);