diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 7850264d83d..28667ca2be5 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -594,6 +594,21 @@ WebIDL::ExceptionOr> Window::session_storage() return JS::NonnullGCPtr { *storage }; } +// https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation +bool Window::has_sticky_activation() const +{ + // When the current high resolution time given W + auto current_time = HighResolutionTime::current_high_resolution_time(*this); + + // is greater than or equal to the last activation timestamp in W + if (current_time >= m_last_activation_timestamp) { + // W is said to have sticky activation. + return true; + } + + return false; +} + // https://html.spec.whatwg.org/multipage/interaction.html#transient-activation bool Window::has_transient_activation() const { diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index 1b4b23534b1..1ac16f4dbef 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -116,6 +116,9 @@ public: AnimationFrameCallbackDriver& animation_frame_callback_driver() { return m_animation_frame_callback_driver; } + // https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation + bool has_sticky_activation() const; + // https://html.spec.whatwg.org/multipage/interaction.html#transient-activation bool has_transient_activation() const;