mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibWeb: Add the missing PageTransitionEvent IDL constructor
This commit is contained in:
parent
4d71f22673
commit
1c4404c46a
4 changed files with 25 additions and 9 deletions
|
@ -282,12 +282,14 @@ float Window::scroll_y() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#fire-a-page-transition-event
|
// https://html.spec.whatwg.org/#fire-a-page-transition-event
|
||||||
void Window::fire_a_page_transition_event(FlyString event_name, bool persisted)
|
void Window::fire_a_page_transition_event(FlyString const& event_name, bool persisted)
|
||||||
{
|
{
|
||||||
// To fire a page transition event named eventName at a Window window with a boolean persisted,
|
// To fire a page transition event named eventName at a Window window with a boolean persisted,
|
||||||
// fire an event named eventName at window, using PageTransitionEvent,
|
// fire an event named eventName at window, using PageTransitionEvent,
|
||||||
// with the persisted attribute initialized to persisted,
|
// with the persisted attribute initialized to persisted,
|
||||||
auto event = HTML::PageTransitionEvent::create(move(event_name), persisted);
|
HTML::PageTransitionEventInit event_init {};
|
||||||
|
event_init.persisted = persisted;
|
||||||
|
auto event = HTML::PageTransitionEvent::create(event_name, event_init);
|
||||||
|
|
||||||
// ...the cancelable attribute initialized to true,
|
// ...the cancelable attribute initialized to true,
|
||||||
event->set_cancelable(true);
|
event->set_cancelable(true);
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
float scroll_x() const;
|
float scroll_x() const;
|
||||||
float scroll_y() const;
|
float scroll_y() const;
|
||||||
|
|
||||||
void fire_a_page_transition_event(FlyString event_name, bool persisted);
|
void fire_a_page_transition_event(FlyString const& event_name, bool persisted);
|
||||||
|
|
||||||
float device_pixel_ratio() const;
|
float device_pixel_ratio() const;
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,21 @@
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
struct PageTransitionEventInit : public DOM::EventInit {
|
||||||
|
bool persisted { false };
|
||||||
|
};
|
||||||
|
|
||||||
class PageTransitionEvent final : public DOM::Event {
|
class PageTransitionEvent final : public DOM::Event {
|
||||||
public:
|
public:
|
||||||
using WrapperType = Bindings::PageTransitionEventWrapper;
|
using WrapperType = Bindings::PageTransitionEventWrapper;
|
||||||
|
|
||||||
static NonnullRefPtr<PageTransitionEvent> create(FlyString event_name, bool persisted)
|
static NonnullRefPtr<PageTransitionEvent> create(FlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new PageTransitionEvent(move(event_name), persisted));
|
return adopt_ref(*new PageTransitionEvent(event_name, event_init));
|
||||||
|
}
|
||||||
|
static NonnullRefPtr<PageTransitionEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||||
|
{
|
||||||
|
return PageTransitionEvent::create(event_name, event_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~PageTransitionEvent() override = default;
|
virtual ~PageTransitionEvent() override = default;
|
||||||
|
@ -24,9 +32,9 @@ public:
|
||||||
bool persisted() const { return m_persisted; }
|
bool persisted() const { return m_persisted; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PageTransitionEvent(FlyString event_name, bool persisted)
|
PageTransitionEvent(FlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||||
: DOM::Event(move(event_name))
|
: DOM::Event(event_name, event_init)
|
||||||
, m_persisted(persisted)
|
, m_persisted(event_init.persisted)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
|
#import <DOM/Event.idl>
|
||||||
|
|
||||||
interface PageTransitionEvent : Event {
|
interface PageTransitionEvent : Event {
|
||||||
|
constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {});
|
||||||
|
|
||||||
readonly attribute boolean persisted;
|
readonly attribute boolean persisted;
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary PageTransitionEventInit : EventInit {
|
||||||
|
boolean persisted = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue