mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 09:48:47 +00:00
LibWeb: Move system visibility state to TraversableNavigable
This no longer belongs in BrowsingContext.
This commit is contained in:
parent
046ae7fe86
commit
38cb15ff49
Notes:
sideshowbarker
2024-07-17 18:23:22 +09:00
Author: https://github.com/awesomekling
Commit: 38cb15ff49
Pull-request: https://github.com/SerenityOS/serenity/pull/21167
Reviewed-by: https://github.com/AtkinsSJ ✅
7 changed files with 37 additions and 40 deletions
|
@ -635,4 +635,33 @@ void finalize_a_same_document_navigation(JS::NonnullGCPtr<TraversableNavigable>
|
|||
traversable->apply_the_push_or_replace_history_step(*target_step);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#system-visibility-state
|
||||
void TraversableNavigable::set_system_visibility_state(VisibilityState visibility_state)
|
||||
{
|
||||
if (m_system_visibility_state == visibility_state)
|
||||
return;
|
||||
m_system_visibility_state = visibility_state;
|
||||
|
||||
// When a user-agent determines that the system visibility state for
|
||||
// traversable navigable traversable has changed to newState, it must run the following steps:
|
||||
|
||||
// 1. Let navigables be the inclusive descendant navigables of traversable.
|
||||
// FIXME: Spec bug: https://github.com/whatwg/html/issues/9758
|
||||
VERIFY(active_document());
|
||||
auto navigables = active_document()->inclusive_descendant_navigables();
|
||||
|
||||
// 2. For each navigable of navigables:
|
||||
for (auto& navigable : navigables) {
|
||||
// 1. Let document be navigable's active document.
|
||||
auto document = navigable->active_document();
|
||||
VERIFY(document);
|
||||
|
||||
// 2. Queue a global task on the user interaction task source given document's relevant global object
|
||||
// to update the visibility state of document with newState.
|
||||
queue_global_task(Task::Source::UserInteraction, relevant_global_object(*document), [visibility_state, document] {
|
||||
document->update_the_visibility_state(visibility_state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue