mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
LibWeb: Introduce the WebGL namespace and add WebGLContextEvent
This commit is contained in:
parent
7d1fcb0cb3
commit
b0c2aee2e4
8 changed files with 74 additions and 1 deletions
|
@ -1895,6 +1895,7 @@ using namespace Web::IntersectionObserver;
|
||||||
using namespace Web::RequestIdleCallback;
|
using namespace Web::RequestIdleCallback;
|
||||||
using namespace Web::ResizeObserver;
|
using namespace Web::ResizeObserver;
|
||||||
using namespace Web::Selection;
|
using namespace Web::Selection;
|
||||||
|
using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
@ -2811,6 +2812,7 @@ using namespace Web::ResizeObserver;
|
||||||
using namespace Web::Selection;
|
using namespace Web::Selection;
|
||||||
using namespace Web::UIEvents;
|
using namespace Web::UIEvents;
|
||||||
using namespace Web::XHR;
|
using namespace Web::XHR;
|
||||||
|
using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
@ -3090,6 +3092,7 @@ using namespace Web::SVG;
|
||||||
using namespace Web::URL;
|
using namespace Web::URL;
|
||||||
using namespace Web::WebSockets;
|
using namespace Web::WebSockets;
|
||||||
using namespace Web::XHR;
|
using namespace Web::XHR;
|
||||||
|
using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
@ -3533,6 +3536,7 @@ using namespace Web::IntersectionObserver;
|
||||||
using namespace Web::RequestIdleCallback;
|
using namespace Web::RequestIdleCallback;
|
||||||
using namespace Web::ResizeObserver;
|
using namespace Web::ResizeObserver;
|
||||||
using namespace Web::Selection;
|
using namespace Web::Selection;
|
||||||
|
using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
@ -3648,6 +3652,7 @@ using namespace Web::ResizeObserver;
|
||||||
using namespace Web::Selection;
|
using namespace Web::Selection;
|
||||||
using namespace Web::XHR;
|
using namespace Web::XHR;
|
||||||
using namespace Web::URL;
|
using namespace Web::URL;
|
||||||
|
using namespace Web::WebGL;
|
||||||
|
|
||||||
namespace Web::Bindings {
|
namespace Web::Bindings {
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto& interface = IDL::Parser(path, data, import_base_path).parse();
|
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;
|
StringBuilder builder;
|
||||||
builder.append(namespace_);
|
builder.append(namespace_);
|
||||||
builder.append("::");
|
builder.append("::");
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <LibWeb/Bindings/ProgressEventWrapper.h>
|
#include <LibWeb/Bindings/ProgressEventWrapper.h>
|
||||||
#include <LibWeb/Bindings/PromiseRejectionEventWrapper.h>
|
#include <LibWeb/Bindings/PromiseRejectionEventWrapper.h>
|
||||||
#include <LibWeb/Bindings/SubmitEventWrapper.h>
|
#include <LibWeb/Bindings/SubmitEventWrapper.h>
|
||||||
|
#include <LibWeb/Bindings/WebGLContextEventWrapper.h>
|
||||||
|
|
||||||
namespace Web::Bindings {
|
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)));
|
return static_cast<ProgressEventWrapper*>(wrap_impl(global_object, static_cast<XHR::ProgressEvent&>(event)));
|
||||||
if (is<UIEvents::UIEvent>(event))
|
if (is<UIEvents::UIEvent>(event))
|
||||||
return static_cast<UIEventWrapper*>(wrap_impl(global_object, static_cast<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));
|
return static_cast<EventWrapper*>(wrap_impl(global_object, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,6 +339,8 @@
|
||||||
#include <LibWeb/Bindings/URLPrototype.h>
|
#include <LibWeb/Bindings/URLPrototype.h>
|
||||||
#include <LibWeb/Bindings/URLSearchParamsConstructor.h>
|
#include <LibWeb/Bindings/URLSearchParamsConstructor.h>
|
||||||
#include <LibWeb/Bindings/URLSearchParamsPrototype.h>
|
#include <LibWeb/Bindings/URLSearchParamsPrototype.h>
|
||||||
|
#include <LibWeb/Bindings/WebGLContextEventConstructor.h>
|
||||||
|
#include <LibWeb/Bindings/WebGLContextEventPrototype.h>
|
||||||
#include <LibWeb/Bindings/WebSocketConstructor.h>
|
#include <LibWeb/Bindings/WebSocketConstructor.h>
|
||||||
#include <LibWeb/Bindings/WebSocketPrototype.h>
|
#include <LibWeb/Bindings/WebSocketPrototype.h>
|
||||||
#include <LibWeb/Bindings/WindowConstructor.h>
|
#include <LibWeb/Bindings/WindowConstructor.h>
|
||||||
|
@ -526,6 +528,7 @@
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \
|
ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \
|
ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(URL) \
|
ADD_WINDOW_OBJECT_INTERFACE(URL) \
|
||||||
|
ADD_WINDOW_OBJECT_INTERFACE(WebGLContextEvent) \
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \
|
ADD_WINDOW_OBJECT_INTERFACE(WebSocket) \
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(Worker) \
|
ADD_WINDOW_OBJECT_INTERFACE(Worker) \
|
||||||
ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \
|
ADD_WINDOW_OBJECT_INTERFACE(XMLHttpRequest) \
|
||||||
|
|
|
@ -377,6 +377,10 @@ class Resource;
|
||||||
class ResourceLoader;
|
class ResourceLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Web::WebGL {
|
||||||
|
class WebGLContextEvent;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Web::XHR {
|
namespace Web::XHR {
|
||||||
class ProgressEvent;
|
class ProgressEvent;
|
||||||
class XMLHttpRequest;
|
class XMLHttpRequest;
|
||||||
|
@ -576,6 +580,7 @@ class URLSearchParamsIteratorWrapper;
|
||||||
class URLSearchParamsPrototype;
|
class URLSearchParamsPrototype;
|
||||||
class URLSearchParamsWrapper;
|
class URLSearchParamsWrapper;
|
||||||
class URLWrapper;
|
class URLWrapper;
|
||||||
|
class WebGLContextEventWrapper;
|
||||||
class WebSocketWrapper;
|
class WebSocketWrapper;
|
||||||
class WindowObject;
|
class WindowObject;
|
||||||
class WindowProxy;
|
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(UIEvents/UIEvent)
|
||||||
libweb_js_wrapper(URL/URL)
|
libweb_js_wrapper(URL/URL)
|
||||||
libweb_js_wrapper(URL/URLSearchParams ITERABLE)
|
libweb_js_wrapper(URL/URLSearchParams ITERABLE)
|
||||||
|
libweb_js_wrapper(WebGL/WebGLContextEvent)
|
||||||
libweb_js_wrapper(WebSockets/WebSocket)
|
libweb_js_wrapper(WebSockets/WebSocket)
|
||||||
libweb_js_wrapper(XHR/ProgressEvent)
|
libweb_js_wrapper(XHR/ProgressEvent)
|
||||||
libweb_js_wrapper(XHR/XMLHttpRequest)
|
libweb_js_wrapper(XHR/XMLHttpRequest)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue