LibWeb: Bring update_the_visibility_state() steps in sync with the spec

No functional changes.
This commit is contained in:
Jelle Raaijmakers 2025-06-24 00:01:30 +02:00 committed by Jelle Raaijmakers
commit 53c35c5d3b
Notes: github-actions[bot] 2025-06-24 09:35:10 +00:00

View file

@ -3384,13 +3384,21 @@ void Document::update_the_visibility_state(HTML::VisibilityState visibility_stat
// 2. Set document's visibility state to visibilityState.
m_visibility_state = visibility_state;
// 3. Run any page visibility change steps which may be defined in other specifications, with visibility state and document.
// FIXME: 3. Queue a new VisibilityStateEntry whose visibility state is visibilityState and whose timestamp is the current
// high resolution time given document's relevant global object.
// FIXME: 4. Run the screen orientation change steps with document.
// FIXME: 5. Run the view transition page visibility change steps with document.
// 6. Run any page visibility change steps which may be defined in other specifications, with visibility state and
// document.
notify_each_document_observer([&](auto const& document_observer) {
return document_observer.document_visibility_state_observer();
},
m_visibility_state);
// 4. Fire an event named visibilitychange at document, with its bubbles attribute initialized to true.
// 7. Fire an event named visibilitychange at document, with its bubbles attribute initialized to true.
auto event = DOM::Event::create(realm(), HTML::EventNames::visibilitychange);
event->set_bubbles(true);
dispatch_event(event);