Skip to content

Commit fe6b82b

Browse files
kennethmyhralinusg
authored andcommitted
LibWeb: Port WebGLContextEvent to new String
1 parent cec1cda commit fe6b82b

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
namespace Web::WebGL {
1111

12-
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, WebGLContextEventInit const& event_init)
12+
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::create(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init)
1313
{
1414
return MUST_OR_THROW_OOM(realm.heap().allocate<WebGLContextEvent>(realm, realm, event_name, event_init));
1515
}
1616

17-
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, WebGLContextEventInit const& event_init)
17+
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> WebGLContextEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, WebGLContextEventInit const& event_init)
1818
{
1919
return create(realm, event_name, event_init);
2020
}
2121

22-
WebGLContextEvent::WebGLContextEvent(JS::Realm& realm, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init)
23-
: DOM::Event(realm, type, event_init)
22+
WebGLContextEvent::WebGLContextEvent(JS::Realm& realm, FlyString const& type, WebGLContextEventInit const& event_init)
23+
: DOM::Event(realm, type.to_deprecated_fly_string(), event_init)
2424
, m_status_message(event_init.status_message)
2525
{
2626
}

Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,32 @@
77

88
#pragma once
99

10+
#include <AK/FlyString.h>
1011
#include <LibWeb/DOM/Event.h>
1112

1213
namespace Web::WebGL {
1314

1415
struct WebGLContextEventInit final : public DOM::EventInit {
15-
DeprecatedString status_message { DeprecatedString::empty() };
16+
String status_message;
1617
};
1718

1819
class WebGLContextEvent final : public DOM::Event {
1920
WEB_PLATFORM_OBJECT(WebGLContextEvent, DOM::Event);
2021

2122
public:
22-
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> create(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init);
23-
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init);
23+
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> create(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init);
24+
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebGLContextEvent>> construct_impl(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init);
2425

2526
virtual ~WebGLContextEvent() override;
2627

27-
DeprecatedString const& status_message() const { return m_status_message; }
28+
String const& status_message() const { return m_status_message; }
2829

2930
private:
30-
WebGLContextEvent(JS::Realm&, DeprecatedFlyString const& type, WebGLContextEventInit const& event_init);
31+
WebGLContextEvent(JS::Realm&, FlyString const& type, WebGLContextEventInit const& event_init);
3132

3233
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
3334

34-
DeprecatedString m_status_message { DeprecatedString::empty() };
35+
String m_status_message;
3536
};
3637

3738
}

Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import <DOM/Event.idl>
22

3-
[Exposed=(Window,Worker)]
3+
[Exposed=(Window,Worker), UseNewAKString]
44
interface WebGLContextEvent : Event {
55
constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
66
readonly attribute DOMString statusMessage;

Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static void fire_webgl_context_event(HTML::HTMLCanvasElement& canvas_element, De
1717
{
1818
// 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.
1919
// FIXME: Consider setting a status message.
20-
auto event = WebGLContextEvent::create(canvas_element.realm(), type, WebGLContextEventInit {}).release_value_but_fixme_should_propagate_errors();
20+
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();
2121
event->set_is_trusted(true);
2222
event->set_cancelable(true);
2323
canvas_element.dispatch_event(*event);

0 commit comments

Comments
 (0)