summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Window.cpp19
-rw-r--r--Userland/Libraries/LibWeb/DOM/Window.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Window.cpp b/Userland/Libraries/LibWeb/DOM/Window.cpp
index 3e2532e9b5..5806c8418c 100644
--- a/Userland/Libraries/LibWeb/DOM/Window.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Window.cpp
@@ -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));
+}
+
}
diff --git a/Userland/Libraries/LibWeb/DOM/Window.h b/Userland/Libraries/LibWeb/DOM/Window.h
index f17873cf49..7800d25cbb 100644
--- a/Userland/Libraries/LibWeb/DOM/Window.h
+++ b/Userland/Libraries/LibWeb/DOM/Window.h
@@ -83,6 +83,8 @@ public:
float scroll_x() const;
float scroll_y() const;
+ void fire_a_page_transition_event(FlyString event_name, bool persisted);
+
private:
explicit Window(Document&);