LibWeb: Report if anything is delaying load event, not the count
Some elements that delay the load event are more complicated than a simple count will allow for. We'll implement those in a bit!
This commit is contained in:
parent
6154681718
commit
6c5450f9ce
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/6c5450f9ce Pull-request: https://github.com/SerenityOS/serenity/pull/22045 Issue: https://github.com/SerenityOS/serenity/issues/22012 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/kalenikaliaksandr ✅
5 changed files with 14 additions and 4 deletions
|
@ -2384,6 +2384,16 @@ void Document::decrement_number_of_things_delaying_the_load_event(Badge<Document
|
|||
page->client().page_did_update_resource_count(m_number_of_things_delaying_the_load_event);
|
||||
}
|
||||
|
||||
bool Document::anything_is_delaying_the_load_event() const
|
||||
{
|
||||
if (m_number_of_things_delaying_the_load_event > 0)
|
||||
return true;
|
||||
|
||||
// FIXME: Track down all the things that are supposed to delay the load event.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Document::invalidate_stacking_context_tree()
|
||||
{
|
||||
if (auto* paintable_box = this->paintable_box())
|
||||
|
|
|
@ -365,7 +365,7 @@ public:
|
|||
|
||||
[[nodiscard]] JS::GCPtr<HTML::Location> location();
|
||||
|
||||
size_t number_of_things_delaying_the_load_event() const { return m_number_of_things_delaying_the_load_event; }
|
||||
bool anything_is_delaying_the_load_event() const;
|
||||
void increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
|
||||
void decrement_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
void set_closing(bool value) { m_closing = value; }
|
||||
|
||||
void set_delaying_load_events(bool value);
|
||||
bool is_delaying_load_events() const { return m_delaying_the_load_event.has_value(); }
|
||||
|
||||
JS::GCPtr<SessionHistoryEntry> active_session_history_entry() const { return m_active_session_history_entry; }
|
||||
void set_active_session_history_entry(JS::GCPtr<SessionHistoryEntry> entry) { m_active_session_history_entry = entry; }
|
||||
|
|
|
@ -304,9 +304,8 @@ void HTMLParser::the_end()
|
|||
});
|
||||
|
||||
// 8. Spin the event loop until there is nothing that delays the load event in the Document.
|
||||
// FIXME: Track down all the things that are supposed to delay the load event.
|
||||
main_thread_event_loop().spin_until([&] {
|
||||
return m_document->number_of_things_delaying_the_load_event() == 0;
|
||||
return !m_document->anything_is_delaying_the_load_event();
|
||||
});
|
||||
|
||||
// 9. Queue a global task on the DOM manipulation task source given the Document's relevant global object to run the following steps:
|
||||
|
|
|
@ -219,7 +219,7 @@ void XMLDocumentBuilder::document_end()
|
|||
|
||||
// Spin the event loop until there is nothing that delays the load event in the Document.
|
||||
HTML::main_thread_event_loop().spin_until([&] {
|
||||
return m_document->number_of_things_delaying_the_load_event() == 0;
|
||||
return !m_document->anything_is_delaying_the_load_event();
|
||||
});
|
||||
|
||||
// Queue a global task on the DOM manipulation task source given the Document's relevant global object to run the following steps:
|
||||
|
|
Loading…
Add table
Reference in a new issue