diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 559328eb0aa..38928fc65d3 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -777,6 +777,7 @@ set(SOURCES WebDriver/TimeoutsConfiguration.cpp WebGL/EventNames.cpp WebGL/OpenGLContext.cpp + WebGL/WebGLBuffer.cpp WebGL/WebGLContextAttributes.cpp WebGL/WebGLContextEvent.cpp WebGL/WebGLObject.cpp diff --git a/Libraries/LibWeb/WebGL/WebGLBuffer.cpp b/Libraries/LibWeb/WebGL/WebGLBuffer.cpp new file mode 100644 index 00000000000..736b48f37b6 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLBuffer.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::WebGL { + +JS_DEFINE_ALLOCATOR(WebGLBuffer); + +WebGLBuffer::WebGLBuffer(JS::Realm& realm) + : WebGLObject(realm) +{ +} + +WebGLBuffer::~WebGLBuffer() = default; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLBuffer.h b/Libraries/LibWeb/WebGL/WebGLBuffer.h new file mode 100644 index 00000000000..35eb12bfc47 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLBuffer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::WebGL { + +class WebGLBuffer final : public WebGLObject { + WEB_PLATFORM_OBJECT(WebGLBuffer, WebGLObject); + JS_DECLARE_ALLOCATOR(WebGLBuffer); + +public: + virtual ~WebGLBuffer(); + +protected: + explicit WebGLBuffer(JS::Realm&); +}; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLBuffer.idl b/Libraries/LibWeb/WebGL/WebGLBuffer.idl new file mode 100644 index 00000000000..c216dcc5516 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLBuffer.idl @@ -0,0 +1,6 @@ +#import + +// https://registry.khronos.org/webgl/specs/latest/1.0/#5.4 +[Exposed=(Window,Worker)] +interface WebGLBuffer : WebGLObject { +}; diff --git a/Libraries/LibWeb/WebGL/WebGLObject.h b/Libraries/LibWeb/WebGL/WebGLObject.h index 068b698f0da..6dd1558dd0b 100644 --- a/Libraries/LibWeb/WebGL/WebGLObject.h +++ b/Libraries/LibWeb/WebGL/WebGLObject.h @@ -11,7 +11,7 @@ namespace Web::WebGL { class WebGLObject : public Bindings::PlatformObject { - WEB_PLATFORM_OBJECT(WebGLRenderingContextBase, Bindings::PlatformObject); + WEB_PLATFORM_OBJECT(WebGLObject, Bindings::PlatformObject); public: virtual ~WebGLObject(); diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 00a8f601c13..01611fb1841 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -359,6 +359,7 @@ libweb_js_bindings(WebAudio/GainNode) libweb_js_bindings(WebAudio/OfflineAudioContext) libweb_js_bindings(WebAudio/OscillatorNode) libweb_js_bindings(WebAudio/PeriodicWave) +libweb_js_bindings(WebGL/WebGLBuffer) libweb_js_bindings(WebGL/WebGLContextEvent) libweb_js_bindings(WebGL/WebGLObject) libweb_js_bindings(WebGL/WebGLRenderingContext) diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni index 2f50882f3f4..daaa7407154 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni @@ -371,6 +371,7 @@ standard_idl_files = [ "//Userland/Libraries/LibWeb/WebAudio/OfflineAudioContext.idl", "//Userland/Libraries/LibWeb/WebAudio/OscillatorNode.idl", "//Userland/Libraries/LibWeb/WebAudio/PeriodicWave.idl", + "//Userland/Libraries/LibWeb/WebGL/WebGLBuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLObject.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.idl", diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 33e96d926b6..597ce1c865f 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -390,6 +390,7 @@ VisualViewport WeakMap WeakRef WeakSet +WebGLBuffer WebGLContextEvent WebGLObject WebGLRenderingContext