mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 04:55:15 +00:00
LibWeb: Add getter for sticky activation
This commit is contained in:
parent
71631c8d21
commit
227151b881
Notes:
sideshowbarker
2024-07-17 08:55:54 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/SerenityOS/serenity/commit/227151b881 Pull-request: https://github.com/SerenityOS/serenity/pull/24437 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/mattco98 Reviewed-by: https://github.com/tcl3
2 changed files with 18 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue