1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:17: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:
Andrew Kaster 2022-09-30 17:16:16 -06:00 committed by Linus Groh
parent cc164dc1e2
commit 56b381aac0
88 changed files with 76 additions and 169 deletions

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;