mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibWeb: Add the PageTransitionEvent interface and fire "pageshow" events
We now fire "pageshow" events at the appropriate time during document loading (done by the parser.) Note that there are no corresponding "pagehide" events yet.
This commit is contained in:
parent
508edcd217
commit
831fdcaabc
7 changed files with 70 additions and 4 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/DOM/EventDispatcher.h>
|
||||
#include <LibWeb/DOM/Timer.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/PageTransitionEvent.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
#include <LibWeb/Layout/InitialContainingBlock.h>
|
||||
#include <LibWeb/Page/BrowsingContext.h>
|
||||
|
@ -276,4 +277,22 @@ float Window::scroll_y() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#fire-a-page-transition-event
|
||||
void Window::fire_a_page_transition_event(FlyString event_name, bool 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,
|
||||
// with the persisted attribute initialized to persisted,
|
||||
auto event = HTML::PageTransitionEvent::create(move(event_name), persisted);
|
||||
|
||||
// ...the cancelable attribute intialized to true,
|
||||
event->set_cancelable(true);
|
||||
|
||||
// the bubbles attribute initialized to true,
|
||||
event->set_bubbles(true);
|
||||
|
||||
// and legacy target override flag set.
|
||||
dispatch_event(move(event));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue