diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-26 12:39:27 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-26 12:47:51 +0200 |
commit | 831fdcaabc95817d4bff9c8bd8a6741227a0b371 (patch) | |
tree | 3a7fcd8b6bcbfbdc28ad648a402c2a819d5842e7 /Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h | |
parent | 508edcd217b23c0cc0107a094269e65373b813de (diff) | |
download | serenity-831fdcaabc95817d4bff9c8bd8a6741227a0b371.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h new file mode 100644 index 0000000000..7c3602ed1f --- /dev/null +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include <LibWeb/DOM/Event.h> + +namespace Web::HTML { + +class PageTransitionEvent final : public DOM::Event { +public: + using WrapperType = Bindings::PageTransitionEventWrapper; + + static NonnullRefPtr<PageTransitionEvent> create(FlyString event_name, bool persisted) + { + return adopt_ref(*new PageTransitionEvent(move(event_name), persisted)); + } + + virtual ~PageTransitionEvent() override = default; + + bool persisted() const { return m_persisted; } + +protected: + PageTransitionEvent(FlyString event_name, bool persisted) + : DOM::Event(move(event_name)) + , m_persisted(persisted) + { + } + + bool m_persisted { false }; +}; + +} |