mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:27:35 +00:00
LibWeb: Remove unecessary dependence on Window from UIEvents classes
These classes only needed Window to get at its realm. Pass a realm directly to construct UIEvents classes.
This commit is contained in:
parent
d0efc7734a
commit
6a10352712
10 changed files with 70 additions and 57 deletions
|
@ -4,33 +4,33 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/UIEvents/UIEvent.h>
|
||||
|
||||
namespace Web::UIEvents {
|
||||
|
||||
UIEvent* UIEvent::create(HTML::Window& window_object, FlyString const& event_name)
|
||||
UIEvent* UIEvent::create(JS::Realm& realm, FlyString const& event_name)
|
||||
{
|
||||
return window_object.heap().allocate<UIEvent>(window_object.realm(), window_object, event_name);
|
||||
return realm.heap().allocate<UIEvent>(realm, realm, event_name);
|
||||
}
|
||||
|
||||
UIEvent* UIEvent::create_with_global_object(HTML::Window& window_object, FlyString const& event_name, UIEventInit const& event_init)
|
||||
UIEvent* UIEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, UIEventInit const& event_init)
|
||||
{
|
||||
return window_object.heap().allocate<UIEvent>(window_object.realm(), window_object, event_name, event_init);
|
||||
return realm.heap().allocate<UIEvent>(realm, realm, event_name, event_init);
|
||||
}
|
||||
|
||||
UIEvent::UIEvent(HTML::Window& window_object, FlyString const& event_name)
|
||||
: Event(window_object, event_name)
|
||||
UIEvent::UIEvent(JS::Realm& realm, FlyString const& event_name)
|
||||
: Event(realm, event_name)
|
||||
{
|
||||
set_prototype(&window_object.cached_web_prototype("UIEvent"));
|
||||
set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent"));
|
||||
}
|
||||
|
||||
UIEvent::UIEvent(HTML::Window& window_object, FlyString const& event_name, UIEventInit const& event_init)
|
||||
: Event(window_object, event_name, event_init)
|
||||
UIEvent::UIEvent(JS::Realm& realm, FlyString const& event_name, UIEventInit const& event_init)
|
||||
: Event(realm, event_name, event_init)
|
||||
, m_view(event_init.view)
|
||||
, m_detail(event_init.detail)
|
||||
{
|
||||
set_prototype(&window_object.cached_web_prototype("UIEvent"));
|
||||
set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent"));
|
||||
}
|
||||
|
||||
UIEvent::~UIEvent() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue