1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +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:
Andreas Kling 2021-09-26 12:39:27 +02:00
parent 508edcd217
commit 831fdcaabc
7 changed files with 70 additions and 4 deletions

View file

@ -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 };
};
}