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:
Andrew Kaster 2022-09-30 17:16:16 -06:00 committed by Linus Groh
parent cc164dc1e2
commit 56b381aac0
Notes: sideshowbarker 2024-07-17 06:27:33 +09:00
88 changed files with 76 additions and 169 deletions

View File

@ -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 {

View File

@ -136,7 +136,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LegacyPlatformObject::le
// FIXME: Can this throw?
if (is_supported_property_index(index)) {
auto value = TRY(throw_dom_exception_if_needed(global_object(), [&] { return item_value(index); }));
auto value = TRY(throw_dom_exception_if_needed(vm(), [&] { return item_value(index); }));
// 5. Let desc be a newly created Property Descriptor with no fields.
JS::PropertyDescriptor descriptor;

View File

@ -6,11 +6,9 @@
#pragma once
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {

View File

@ -23,11 +23,6 @@ AbortSignal::AbortSignal(JS::Realm& realm)
set_prototype(&Bindings::cached_web_prototype(realm, "AbortSignal"));
}
AbortSignal::AbortSignal(HTML::Window& window)
: AbortSignal(window.realm())
{
}
// https://dom.spec.whatwg.org/#abortsignal-add
void AbortSignal::add_abort_algorithm(Function<void()> abort_algorithm)
{

View File

@ -40,7 +40,6 @@ public:
private:
explicit AbortSignal(JS::Realm&);
explicit AbortSignal(HTML::Window&);
virtual void visit_edges(JS::Cell::Visitor&) override;

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/CDATASection.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {

View File

@ -10,7 +10,6 @@
#include <LibWeb/DOM/DOMTokenList.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/WebIDL/DOMException.h>
namespace {
@ -55,7 +54,7 @@ namespace Web::DOM {
DOMTokenList* DOMTokenList::create(Element const& associated_element, FlyString associated_attribute)
{
auto& realm = associated_element.document().window().realm();
auto& realm = associated_element.realm();
return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute));
}

View File

@ -288,11 +288,6 @@ JS::NonnullGCPtr<Document> Document::create(JS::Realm& realm, AK::URL const& url
return *realm.heap().allocate<Document>(realm, realm, url);
}
JS::NonnullGCPtr<Document> Document::create(HTML::Window& window, AK::URL const& url)
{
return create(window.realm(), url);
}
Document::Document(JS::Realm& realm, const AK::URL& url)
: ParentNode(realm, *this, NodeType::DOCUMENT_NODE)
, m_style_computer(make<CSS::StyleComputer>(*this))

View File

@ -84,7 +84,6 @@ public:
static JS::NonnullGCPtr<Document> create_and_initialize(Type, String content_type, HTML::NavigationParams);
static JS::NonnullGCPtr<Document> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
static JS::NonnullGCPtr<Document> create(HTML::Window&, AK::URL const& url = "about:blank"sv);
static JS::NonnullGCPtr<Document> construct_impl(JS::Realm&);
virtual ~Document() override;

View File

@ -11,7 +11,6 @@
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {
@ -20,11 +19,6 @@ JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString const& event_n
return *realm.heap().allocate<Event>(realm, realm, event_name, event_init);
}
JS::NonnullGCPtr<Event> Event::create(HTML::Window& window, FlyString const& event_name, EventInit const& event_init)
{
return create(window.realm(), event_name, event_init);
}
JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
{
return create(realm, event_name, event_init);
@ -47,16 +41,6 @@ Event::Event(JS::Realm& realm, FlyString const& type, EventInit const& event_ini
{
}
Event::Event(HTML::Window& window, FlyString const& type, EventInit const& event_init)
: Event(window.realm(), type, event_init)
{
}
Event::Event(HTML::Window& window, FlyString const& type)
: Event(window.realm(), type)
{
}
void Event::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);

View File

@ -46,13 +46,10 @@ public:
using Path = Vector<PathEntry>;
static JS::NonnullGCPtr<Event> create(JS::Realm&, FlyString const& event_name, EventInit const& event_init = {});
static JS::NonnullGCPtr<Event> create(HTML::Window&, FlyString const& event_name, EventInit const& event_init = {});
static JS::NonnullGCPtr<Event> construct_impl(JS::Realm&, FlyString const& event_name, EventInit const& event_init);
Event(JS::Realm&, FlyString const& type);
Event(JS::Realm&, FlyString const& type, EventInit const& event_init);
Event(HTML::Window&, FlyString const& type);
Event(HTML::Window&, FlyString const& type, EventInit const& event_init);
virtual ~Event() = default;

View File

@ -5,7 +5,6 @@
*/
#include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {

View File

@ -7,7 +7,6 @@
#include <LibWeb/DOM/LiveNodeList.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {

View File

@ -4,9 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/DOM/NodeFilter.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {

View File

@ -41,8 +41,8 @@ JS::NonnullGCPtr<NodeIterator> NodeIterator::create(Node& root, unsigned what_to
// 1. Let iterator be a new NodeIterator object.
// 2. Set iterators root and iterators reference to root.
// 3. Set iterators pointer before reference to true.
auto& window_object = root.document().window();
auto* iterator = window_object.heap().allocate<NodeIterator>(window_object.realm(), root);
auto& realm = root.realm();
auto* iterator = realm.heap().allocate<NodeIterator>(realm, root);
// 4. Set iterators whatToShow to whatToShow.
iterator->m_what_to_show = what_to_show;

View File

@ -13,7 +13,6 @@
#include <LibWeb/DOM/ParentNode.h>
#include <LibWeb/DOM/StaticNodeList.h>
#include <LibWeb/Dump.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h>
namespace Web::DOM {

View File

@ -18,7 +18,7 @@ class Text : public CharacterData {
public:
virtual ~Text() override = default;
static JS::NonnullGCPtr<Text> construct_impl(JS::Realm& window, String const& data);
static JS::NonnullGCPtr<Text> construct_impl(JS::Realm& realm, String const& data);
// ^Node
virtual FlyString node_name() const override { return "#text"; }

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/NodeFilter.h>
#include <LibWeb/DOM/TreeWalker.h>
@ -35,8 +35,8 @@ JS::NonnullGCPtr<TreeWalker> TreeWalker::create(Node& root, unsigned what_to_sho
{
// 1. Let walker be a new TreeWalker object.
// 2. Set walkers root and walkers current to root.
auto& window_object = root.document().window();
auto* walker = window_object.heap().allocate<TreeWalker>(window_object.realm(), root);
auto& realm = root.realm();
auto* walker = realm.heap().allocate<TreeWalker>(realm, root);
// 3. Set walkers whatToShow to whatToShow.
walker->m_what_to_show = what_to_show;

View File

@ -161,7 +161,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob
// 4. Let steps be to return the result of package data with the first argument given, type, and objects MIME type.
auto steps = [&realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
VERIFY(value.is_string());
auto bytes = TRY_OR_RETURN_OOM(realm.global_object(), ByteBuffer::copy(value.as_string().string().bytes()));
auto bytes = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(value.as_string().string().bytes()));
return package_data(realm, move(bytes), type, object.mime_type_impl());
};

View File

@ -6,7 +6,6 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Geometry/DOMPoint.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Geometry {

View File

@ -6,7 +6,6 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/CloseEvent.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {
@ -15,11 +14,6 @@ CloseEvent* CloseEvent::create(JS::Realm& realm, FlyString const& event_name, Cl
return realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init);
}
CloseEvent* CloseEvent::create(HTML::Window& window, FlyString const& event_name, CloseEventInit const& event_init)
{
return create(window.realm(), event_name, event_init);
}
CloseEvent* CloseEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, CloseEventInit const& event_init)
{
return create(realm, event_name, event_init);

View File

@ -22,7 +22,6 @@ class CloseEvent : public DOM::Event {
public:
static CloseEvent* create(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init = {});
static CloseEvent* create(HTML::Window&, FlyString const& event_name, CloseEventInit const& event_init = {});
static CloseEvent* construct_impl(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init);
virtual ~CloseEvent() override;

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLDataElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLDataListElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLDetailsElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLDialogElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLDivElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLEmbedElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLFieldSetElement.h>
#include <LibWeb/HTML/HTMLLegendElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/CSS/StyleValue.h>
#include <LibWeb/HTML/HTMLFontElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLFrameElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLHRElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLHeadElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLHeadingElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,9 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/HTMLLegendElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLLegendElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMapElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMarqueeElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -5,8 +5,8 @@
*/
#include <LibWeb/Bindings/HTMLMediaElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMediaElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMenuElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMetaElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLMeterElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLModElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLOListElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -6,13 +6,13 @@
*/
#include <AK/StringBuilder.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
#include <LibWeb/HTML/HTMLOptionElement.h>
#include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/HTMLSelectElement.h>
#include <LibWeb/HTML/Window.h>
#include <ctype.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLOutputElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLParagraphElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLParamElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLPictureElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLPreElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLQuoteElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -7,6 +7,7 @@
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <LibTextCodec/Decoder.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/ShadowRoot.h>
@ -14,7 +15,6 @@
#include <LibWeb/HTML/EventNames.h>
#include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Web::HTML {

View File

@ -5,11 +5,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLOptGroupElement.h>
#include <LibWeb/HTML/HTMLOptionElement.h>
#include <LibWeb/HTML/HTMLSelectElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLSourceElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLSpanElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLTableCaptionElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLTableColElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -5,6 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/HTMLCollection.h>
@ -12,7 +13,6 @@
#include <LibWeb/HTML/HTMLTableElement.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h>
namespace Web::HTML {

View File

@ -4,12 +4,12 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableElement.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
#include <LibWeb/HTML/HTMLTableSectionElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -5,11 +5,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/HTMLCollection.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
#include <LibWeb/HTML/HTMLTableSectionElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Namespace.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLTextAreaElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLTimeElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLTrackElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLUListElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLUnknownElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLVideoElement.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {

View File

@ -6,7 +6,6 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/MessageEvent.h>
#include <LibWeb/HTML/Window.h>
namespace Web::HTML {
@ -15,11 +14,6 @@ MessageEvent* MessageEvent::create(JS::Realm& realm, FlyString const& event_name
return realm.heap().allocate<MessageEvent>(realm, realm, event_name, event_init);
}
MessageEvent* MessageEvent::create(HTML::Window& window, FlyString const& event_name, MessageEventInit const& event_init)
{
return create(window.realm(), event_name, event_init);
}
MessageEvent* MessageEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MessageEventInit const& event_init)
{
return create(realm, event_name, event_init);

View File

@ -22,7 +22,6 @@ class MessageEvent : public DOM::Event {
public:
static MessageEvent* create(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init = {});
static MessageEvent* create(HTML::Window&, FlyString const& event_name, MessageEventInit const& event_init = {});
static MessageEvent* construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);
MessageEvent(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);

View File

@ -53,13 +53,12 @@ WebIDL::ExceptionOr<String> serialize_javascript_value_to_json_string(JS::VM& vm
WebIDL::ExceptionOr<ByteBuffer> serialize_javascript_value_to_json_bytes(JS::VM& vm, JS::Value value)
{
auto& realm = *vm.current_realm();
auto& global_object = realm.global_object();
// 1. Let string be the result of serializing a JavaScript value to a JSON string given value.
auto string = TRY(serialize_javascript_value_to_json_string(vm, value));
// 2. Return the result of running UTF-8 encode on string. [ENCODING]
return TRY_OR_RETURN_OOM(global_object, ByteBuffer::copy(string.bytes()));
return TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(string.bytes()));
}
}

View File

@ -12,7 +12,6 @@
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Page/EventHandler.h>
#include <LibWeb/Page/Page.h>

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/SVG/SVGClipPathElement.h>
namespace Web::SVG {

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/SVG/SVGDefsElement.h>
namespace Web::SVG {

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/SVG/SVGElement.h>
namespace Web::SVG {

View File

@ -5,8 +5,8 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
#include <LibWeb/SVG/SVGSVGElement.h>

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/SVG/AttributeNames.h>
#include <LibWeb/SVG/AttributeParser.h>
#include <LibWeb/SVG/SVGLineElement.h>

View File

@ -91,11 +91,6 @@ KeyboardEvent* KeyboardEvent::create_from_platform_event(JS::Realm& realm, FlySt
return KeyboardEvent::create(realm, event_name, event_init);
}
KeyboardEvent* KeyboardEvent::create_from_platform_event(HTML::Window& window, FlyString const& event_name, KeyCode platform_key, unsigned modifiers, u32 code_point)
{
return create_from_platform_event(window.realm(), event_name, platform_key, modifiers, code_point);
}
bool KeyboardEvent::get_modifier_state(String const& key_arg)
{
if (key_arg == "Alt")

View File

@ -31,7 +31,6 @@ public:
static KeyboardEvent* create(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init = {});
static KeyboardEvent* construct_impl(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init);
static KeyboardEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
static KeyboardEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
virtual ~KeyboardEvent() override;

View File

@ -62,11 +62,6 @@ MouseEvent* MouseEvent::create_from_platform_event(JS::Realm& realm, FlyString c
return MouseEvent::create(realm, event_name, event_init);
}
MouseEvent* MouseEvent::create_from_platform_event(HTML::Window& window, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button)
{
return create_from_platform_event(window.realm(), event_name, offset_x, offset_y, client_x, client_y, mouse_button);
}
void MouseEvent::set_event_characteristics()
{
if (type().is_one_of(EventNames::mousedown, EventNames::mousemove, EventNames::mouseout, EventNames::mouseover, EventNames::mouseup, HTML::EventNames::click)) {

View File

@ -27,7 +27,6 @@ class MouseEvent final : public UIEvent {
public:
static MouseEvent* create(JS::Realm&, FlyString const& event_name, MouseEventInit const& event_init = {});
static MouseEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
static MouseEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
virtual ~MouseEvent() override;

View File

@ -7,11 +7,9 @@
#pragma once
#include "WebAssemblyMemoryConstructor.h"
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {

View File

@ -5,6 +5,7 @@
*/
#include "WebAssemblyModulePrototype.h"
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/WebAssembly/WebAssemblyModuleObject.h>
namespace Web::Bindings {

View File

@ -7,11 +7,9 @@
#pragma once
#include "WebAssemblyModuleConstructor.h"
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {

View File

@ -5,6 +5,7 @@
*/
#include "WebAssemblyTablePrototype.h"
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/WebAssembly/WebAssemblyTableObject.h>
namespace Web::Bindings {

View File

@ -7,11 +7,9 @@
#pragma once
#include "WebAssemblyTableConstructor.h"
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {

View File

@ -123,17 +123,13 @@ private:
FlyString m_message;
};
#define __ENUMERATE(ErrorName) \
class ErrorName final { \
public: \
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& message) \
{ \
return DOMException::create(realm, #ErrorName, message); \
} \
static JS::NonnullGCPtr<DOMException> create(JS::Object const& global_object, FlyString const& message) \
{ \
return create(HTML::relevant_realm(global_object), message); \
} \
#define __ENUMERATE(ErrorName) \
class ErrorName final { \
public: \
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& message) \
{ \
return DOMException::create(realm, #ErrorName, message); \
} \
};
ENUMERATE_DOM_EXCEPTION_ERROR_NAMES
#undef __ENUMERATE