mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
LibWeb: Introduce the WebGL namespace and add WebGLContextEvent
This commit is contained in:
parent
7d1fcb0cb3
commit
b0c2aee2e4
Notes:
sideshowbarker
2024-07-17 10:16:15 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/b0c2aee2e4 Pull-request: https://github.com/SerenityOS/serenity/pull/14184 Reviewed-by: https://github.com/Quaker762 ✅ Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/sunverwerth
8 changed files with 74 additions and 1 deletions
|
@ -1895,6 +1895,7 @@ using namespace Web::IntersectionObserver;
|
|||
using namespace Web::RequestIdleCallback;
|
||||
using namespace Web::ResizeObserver;
|
||||
using namespace Web::Selection;
|
||||
using namespace Web::WebGL;
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -2811,6 +2812,7 @@ using namespace Web::ResizeObserver;
|
|||
using namespace Web::Selection;
|
||||
using namespace Web::UIEvents;
|
||||
using namespace Web::XHR;
|
||||
using namespace Web::WebGL;
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -3090,6 +3092,7 @@ using namespace Web::SVG;
|
|||
using namespace Web::URL;
|
||||
using namespace Web::WebSockets;
|
||||
using namespace Web::XHR;
|
||||
using namespace Web::WebGL;
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -3533,6 +3536,7 @@ using namespace Web::IntersectionObserver;
|
|||
using namespace Web::RequestIdleCallback;
|
||||
using namespace Web::ResizeObserver;
|
||||
using namespace Web::Selection;
|
||||
using namespace Web::WebGL;
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -3648,6 +3652,7 @@ using namespace Web::ResizeObserver;
|
|||
using namespace Web::Selection;
|
||||
using namespace Web::XHR;
|
||||
using namespace Web::URL;
|
||||
using namespace Web::WebGL;
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& interface = IDL::Parser(path, data, import_base_path).parse();
|
||||
|
||||
if (namespace_.is_one_of("Crypto", "CSS", "DOM", "Encoding", "HTML", "UIEvents", "Geometry", "HighResolutionTime", "IntersectionObserver", "NavigationTiming", "RequestIdleCallback", "ResizeObserver", "SVG", "Selection", "URL", "WebSockets", "XHR")) {
|
||||
if (namespace_.is_one_of("Crypto", "CSS", "DOM", "Encoding", "HTML", "UIEvents", "Geometry", "HighResolutionTime", "IntersectionObserver", "NavigationTiming", "RequestIdleCallback", "ResizeObserver", "SVG", "Selection", "URL", "WebGL", "WebSockets", "XHR")) {
|
||||
StringBuilder builder;
|
||||
builder.append(namespace_);
|
||||
builder.append("::");
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <LibWeb/Bindings/ProgressEventWrapper.h>
|
||||
#include <LibWeb/Bindings/PromiseRejectionEventWrapper.h>
|
||||
#include <LibWeb/Bindings/SubmitEventWrapper.h>
|
||||
#include <LibWeb/Bindings/WebGLContextEventWrapper.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
|
@ -47,6 +48,8 @@ EventWrapper* wrap(JS::GlobalObject& global_object, DOM::Event& event)
|
|||
return static_cast<ProgressEventWrapper*>(wrap_impl(global_object, static_cast<XHR::ProgressEvent&>(event)));
|
||||
if (is<UIEvents::UIEvent>(event))
|
||||
return static_cast<UIEventWrapper*>(wrap_impl(global_object, static_cast<UIEvents::UIEvent&>(event)));
|
||||
if (is<WebGL::WebGLContextEvent>(event))
|
||||
return static_cast<WebGLContextEventWrapper*>(wrap_impl(global_object, static_cast<WebGL::WebGLContextEvent&>(event)));
|
||||
return static_cast<EventWrapper*>(wrap_impl(global_object, event));
|
||||
}
|
||||
|
||||
|
|
|
@ -339,6 +339,8 @@
|
|||
#include <LibWeb/Bindings/URLPrototype.h>
|
||||
#include <LibWeb/Bindings/URLSearchParamsConstructor.h>
|
||||
#include <LibWeb/Bindings/URLSearchParamsPrototype.h>
|
||||
#include <LibWeb/Bindings/WebGLContextEventConstructor.h>
|
||||
#include <LibWeb/Bindings/WebGLContextEventPrototype.h>
|
||||
#include <LibWeb/Bindings/WebSocketConstructor.h>
|
||||
#include <LibWeb/Bindings/WebSocketPrototype.h>
|
||||
#include <LibWeb/Bindings/WindowConstructor.h>
|
||||
|
@ -526,6 +528,7 @@
|
|||
ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(URL) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(WebGLContextEvent) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(Worker) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \
|
||||
|
|
|
@ -377,6 +377,10 @@ class Resource;
|
|||
class ResourceLoader;
|
||||
}
|
||||
|
||||
namespace Web::WebGL {
|
||||
class WebGLContextEvent;
|
||||
}
|
||||
|
||||
namespace Web::XHR {
|
||||
class ProgressEvent;
|
||||
class XMLHttpRequest;
|
||||
|
@ -576,6 +580,7 @@ class URLSearchParamsIteratorWrapper;
|
|||
class URLSearchParamsPrototype;
|
||||
class URLSearchParamsWrapper;
|
||||
class URLWrapper;
|
||||
class WebGLContextEventWrapper;
|
||||
class WebSocketWrapper;
|
||||
class WindowObject;
|
||||
class WindowProxy;
|
||||
|
|
45
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h
Normal file
45
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
|
||||
namespace Web::WebGL {
|
||||
|
||||
struct WebGLContextEventInit final : public DOM::EventInit {
|
||||
String status_message { String::empty() };
|
||||
};
|
||||
|
||||
class WebGLContextEvent final : public DOM::Event {
|
||||
public:
|
||||
using WrapperType = Bindings::WebGLContextEventWrapper;
|
||||
|
||||
static NonnullRefPtr<WebGLContextEvent> create(FlyString const& type, WebGLContextEventInit const& event_init)
|
||||
{
|
||||
return adopt_ref(*new WebGLContextEvent(type, event_init));
|
||||
}
|
||||
|
||||
static NonnullRefPtr<WebGLContextEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& type, WebGLContextEventInit const& event_init)
|
||||
{
|
||||
return adopt_ref(*new WebGLContextEvent(type, event_init));
|
||||
}
|
||||
|
||||
virtual ~WebGLContextEvent() override = default;
|
||||
|
||||
String const& status_message() const { return m_status_message; }
|
||||
|
||||
private:
|
||||
WebGLContextEvent(FlyString const& type, WebGLContextEventInit const& event_init)
|
||||
: DOM::Event(type, event_init)
|
||||
, m_status_message(event_init.status_message)
|
||||
{
|
||||
}
|
||||
|
||||
String m_status_message { String::empty() };
|
||||
};
|
||||
|
||||
}
|
11
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl
Normal file
11
Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl
Normal file
|
@ -0,0 +1,11 @@
|
|||
#import <DOM/Event.idl>
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface WebGLContextEvent : Event {
|
||||
constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
|
||||
readonly attribute DOMString statusMessage;
|
||||
};
|
||||
|
||||
dictionary WebGLContextEventInit : EventInit {
|
||||
DOMString statusMessage = "";
|
||||
};
|
|
@ -172,6 +172,7 @@ libweb_js_wrapper(UIEvents/MouseEvent)
|
|||
libweb_js_wrapper(UIEvents/UIEvent)
|
||||
libweb_js_wrapper(URL/URL)
|
||||
libweb_js_wrapper(URL/URLSearchParams ITERABLE)
|
||||
libweb_js_wrapper(WebGL/WebGLContextEvent)
|
||||
libweb_js_wrapper(WebSockets/WebSocket)
|
||||
libweb_js_wrapper(XHR/ProgressEvent)
|
||||
libweb_js_wrapper(XHR/XMLHttpRequest)
|
||||
|
|
Loading…
Reference in a new issue