1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:27:35 +00:00

LibWeb: Move CallbackType from Bindings/ to WebIDL/

Let's stop putting generic types and AOs from the Web IDL spec into
the Bindings namespace and directory in LibWeb, and instead follow our
usual naming rules of 'directory = namespace = spec name'. The IDL
namespace is already used by LibIDL, so Web::WebIDL seems like a good
choice.
This commit is contained in:
Linus Groh 2022-09-24 16:02:41 +01:00
parent dc44effd44
commit 4f73851afc
43 changed files with 168 additions and 165 deletions

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/Object.h>
#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::WebIDL {
CallbackType::CallbackType(JS::Object& callback, HTML::EnvironmentSettingsObject& callback_context)
: callback(callback)
, callback_context(callback_context)
{
}
StringView CallbackType::class_name() const { return "CallbackType"sv; }
void CallbackType::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
visitor.visit(&callback);
}
}

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Heap/Cell.h>
#include <LibWeb/Forward.h>
namespace Web::WebIDL {
// https://heycam.github.io/webidl/#idl-callback-interface
class CallbackType final : public JS::Cell {
public:
CallbackType(JS::Object& callback, HTML::EnvironmentSettingsObject& callback_context);
JS::Object& callback;
// https://heycam.github.io/webidl/#dfn-callback-context
HTML::EnvironmentSettingsObject& callback_context;
private:
virtual StringView class_name() const override;
virtual void visit_edges(Cell::Visitor&) override;
};
}