mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LibWeb: Cleanup unecessary uses and includes of HTML::Window
The big global refactor left some stragglers behind for atomicity. Clean up the rest, and remove a ton of includes of LibWeb/HTML/Window.h
This commit is contained in:
parent
cc164dc1e2
commit
56b381aac0
88 changed files with 76 additions and 169 deletions
|
@ -2039,7 +2039,6 @@ void generate_constructor_implementation(IDL::Interface const& interface)
|
|||
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#if __has_include(<LibWeb/Crypto/@name@.h>)
|
||||
# include <LibWeb/Crypto/@name@.h>
|
||||
#elif __has_include(<LibWeb/CSS/@name@.h>)
|
||||
|
@ -2141,8 +2140,7 @@ JS::ThrowCompletionOr<JS::Object*> @constructor_class@::construct(FunctionObject
|
|||
|
||||
generator.append(R"~~~(
|
||||
auto& vm = this->vm();
|
||||
[[maybe_unused]] auto& realm = *vm.current_realm();
|
||||
[[maybe_unused]] auto& window = verify_cast<HTML::Window>(realm.global_object());
|
||||
auto& realm = *vm.current_realm();
|
||||
)~~~");
|
||||
|
||||
if (!constructor.parameters.is_empty()) {
|
||||
|
@ -2153,29 +2151,14 @@ JS::ThrowCompletionOr<JS::Object*> @constructor_class@::construct(FunctionObject
|
|||
generator.set(".constructor_arguments", arguments_builder.string_view());
|
||||
|
||||
generator.append(R"~~~(
|
||||
auto construct_impl = [&] <typename T>() {
|
||||
if constexpr (requires(T) { T::construct_impl(declval<::JS::Realm&>(), @.constructor_arguments@ ); })
|
||||
return T::construct_impl(realm, @.constructor_arguments@);
|
||||
else if constexpr (requires(T) { T::create_with_global_object(declval<::Web::HTML::Window&>(), @.constructor_arguments@); })
|
||||
return T::create_with_global_object(window, @.constructor_arguments@);
|
||||
else if constexpr (requires(T) { sizeof(T); })
|
||||
static_assert(DependentFalse<T>, "Bound type is missing constructor factory");
|
||||
};
|
||||
auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return @fully_qualified_name@::construct_impl(realm, @.constructor_arguments@); }));
|
||||
)~~~");
|
||||
} else {
|
||||
generator.append(R"~~~(
|
||||
auto construct_impl = [&] <typename T>() {
|
||||
if constexpr (requires(T) { T::construct_impl(declval<::JS::Realm&>()); })
|
||||
return T::construct_impl(realm);
|
||||
else if constexpr (requires(T) { T::create_with_global_object(declval<::Web::HTML::Window&>()); })
|
||||
return T::create_with_global_object(window);
|
||||
else if constexpr (requires(T) { sizeof(T); })
|
||||
static_assert(DependentFalse<T>, "Bound type is missing constructor factory");
|
||||
};
|
||||
auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return @fully_qualified_name@::construct_impl(realm); }));
|
||||
)~~~");
|
||||
}
|
||||
generator.append(R"~~~(
|
||||
auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return construct_impl.operator()<@fully_qualified_name@>(); }));
|
||||
return &(*impl);
|
||||
)~~~");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue