1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:47:34 +00:00

LibWeb: Add WebGL::EventNames

This commit is contained in:
Kenneth Myhra 2023-04-09 12:54:00 +02:00 committed by Linus Groh
parent f9d50e6eca
commit fb96966f1e
4 changed files with 57 additions and 0 deletions

View file

@ -40,6 +40,7 @@
#include <LibWeb/SVG/AttributeNames.h>
#include <LibWeb/SVG/TagNames.h>
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/WebGL/EventNames.h>
#include <LibWeb/WebIDL/AbstractOperations.h>
#include <LibWeb/XHR/EventNames.h>
@ -89,6 +90,7 @@ ErrorOr<void> initialize_main_thread_vm()
TRY(SVG::AttributeNames::initialize_strings());
TRY(SVG::TagNames::initialize_strings());
TRY(UIEvents::EventNames::initialize_strings());
TRY(WebGL::EventNames::initialize_strings());
TRY(XHR::EventNames::initialize_strings());
static_cast<WebEngineCustomData*>(s_main_thread_vm->custom_data())->event_loop.set_vm(*s_main_thread_vm);

View file

@ -518,6 +518,7 @@ set(SOURCES
WebDriver/Response.cpp
WebDriver/Screenshot.cpp
WebDriver/TimeoutsConfiguration.cpp
WebGL/EventNames.cpp
WebGL/WebGLContextAttributes.cpp
WebGL/WebGLContextEvent.cpp
WebGL/WebGLRenderingContext.cpp

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/WebGL/EventNames.h>
namespace Web::WebGL::EventNames {
#define __ENUMERATE_GL_EVENT(name) FlyString name;
ENUMERATE_GL_EVENTS
#undef __ENUMERATE_GL_EVENT
ErrorOr<void> initialize_strings()
{
static bool s_initialized = false;
VERIFY(!s_initialized);
#define __ENUMERATE_GL_EVENT(name) \
name = TRY(#name##_fly_string);
ENUMERATE_GL_EVENTS
#undef __ENUMERATE_GL_EVENT
s_initialized = true;
return {};
}
}

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Error.h>
#include <AK/FlyString.h>
namespace Web::WebGL::EventNames {
#define ENUMERATE_GL_EVENTS \
__ENUMERATE_GL_EVENT(webglcontextcreationerror) \
__ENUMERATE_GL_EVENT(webglcontextlost) \
__ENUMERATE_GL_EVENT(webglcontextrestored)
#define __ENUMERATE_GL_EVENT(name) extern FlyString name;
ENUMERATE_GL_EVENTS
#undef __ENUMERATE_GL_EVENT
ErrorOr<void> initialize_strings();
}