LibWeb: Add getter for sticky activation

This commit is contained in:
Jamie Mansfield 2024-05-25 12:34:17 +01:00 committed by Andrew Kaster
parent 71631c8d21
commit 227151b881
Notes: sideshowbarker 2024-07-17 08:55:54 +09:00
2 changed files with 18 additions and 0 deletions

View file

@ -594,6 +594,21 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> 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
{

View file

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