LibWeb: Don't lose change events on MediaQueryList internal state change

MediaQueryList will now remember if a state change occurred when
evaluating its match state. This memory can then be used by the document
later on when it's updating all queries, to ensure that we don't forget
to fire at least one change event.

This also required plumbing the system visibility state to initial
about:blank documents, since otherwise they would be stuck in "hidden"
state indefinitely and never evaluate their media queries.
This commit is contained in:
Andreas Kling 2025-02-13 14:09:39 +01:00 committed by Andreas Kling
commit c9cd795257
Notes: github-actions[bot] 2025-02-13 19:53:28 +00:00
7 changed files with 78 additions and 23 deletions

View file

@ -109,6 +109,9 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable(GC::Ptr
// 11. Let traversable be parentNavigable's traversable navigable.
auto traversable = parent_navigable->traversable_navigable();
// AD-HOC: Let the initial about:blank document inherit the system visibility state from traversable.
document->update_the_visibility_state(traversable->system_visibility_state());
// 12. Append the following session history traversal steps to traversable:
traversable->append_session_history_traversal_steps(GC::create_function(heap(), [traversable, navigable, parent_navigable, history_entry, after_session_history_update] {
// 1. Let parentDocState be parentNavigable's active session history entry's document state.