mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 16:58:52 +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
|
@ -776,35 +776,6 @@ bool BrowsingContext::document_family_contains(DOM::Document const& document) co
|
|||
return document_family().first_matching([&](auto& entry) { return entry.ptr() == &document; }).has_value();
|
||||
}
|
||||
|
||||
VisibilityState BrowsingContext::system_visibility_state() const
|
||||
{
|
||||
return m_system_visibility_state;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#system-visibility-state
|
||||
void BrowsingContext::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 top-level browsing context context
|
||||
// has changed to newState, it must queue a task on the user interaction task source to update
|
||||
// the visibility state of all the Document objects in the top-level browsing context's document family with newState.
|
||||
auto document_family = top_level_browsing_context()->document_family();
|
||||
|
||||
// From the new navigable version, where it tells us what global object to use here:
|
||||
// 1. Let document be navigable's active 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.
|
||||
// FIXME: Update this function to fully match the navigable version.
|
||||
VERIFY(active_document());
|
||||
queue_global_task(Task::Source::UserInteraction, relevant_global_object(*active_document()), [visibility_state, document_family = move(document_family)] {
|
||||
for (auto& document : document_family) {
|
||||
document->update_the_visibility_state(visibility_state);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void BrowsingContext::append_child(JS::NonnullGCPtr<BrowsingContext> child)
|
||||
{
|
||||
VERIFY(!child->m_parent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue