mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:22:13 +00:00
LibWeb: Use DocumentLoadEventDelayer to delay load event in Navigable
Use a delayer object that actually delays load event for child navigables instead of boolean flag that does nothing.
This commit is contained in:
parent
b398d6a35c
commit
6522fa8933
2 changed files with 14 additions and 3 deletions
|
@ -90,6 +90,17 @@ void Navigable::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_container);
|
visitor.visit(m_container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Navigable::set_delaying_load_events(bool value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
auto document = container_document();
|
||||||
|
VERIFY(document);
|
||||||
|
m_delaying_the_load_event.emplace(*document);
|
||||||
|
} else {
|
||||||
|
m_delaying_the_load_event.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JS::GCPtr<Navigable> Navigable::navigable_with_active_document(JS::NonnullGCPtr<DOM::Document> document)
|
JS::GCPtr<Navigable> Navigable::navigable_with_active_document(JS::NonnullGCPtr<DOM::Document> document)
|
||||||
{
|
{
|
||||||
for (auto* navigable : all_navigables()) {
|
for (auto* navigable : all_navigables()) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
#include <LibWeb/Bindings/NavigationPrototype.h>
|
#include <LibWeb/Bindings/NavigationPrototype.h>
|
||||||
|
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/HTML/ActivateTab.h>
|
#include <LibWeb/HTML/ActivateTab.h>
|
||||||
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
||||||
|
@ -56,8 +57,7 @@ public:
|
||||||
bool is_closing() const { return m_closing; }
|
bool is_closing() const { return m_closing; }
|
||||||
void set_closing(bool value) { m_closing = value; }
|
void set_closing(bool value) { m_closing = value; }
|
||||||
|
|
||||||
bool is_delaying_load_events() const { return m_delaying_load_events; }
|
void set_delaying_load_events(bool value);
|
||||||
void set_delaying_load_events(bool value) { m_delaying_load_events = value; }
|
|
||||||
|
|
||||||
JS::GCPtr<SessionHistoryEntry> active_session_history_entry() const { return m_active_session_history_entry; }
|
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; }
|
void set_active_session_history_entry(JS::GCPtr<SessionHistoryEntry> entry) { m_active_session_history_entry = entry; }
|
||||||
|
@ -160,7 +160,7 @@ private:
|
||||||
bool m_closing { false };
|
bool m_closing { false };
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#delaying-load-events-mode
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#delaying-load-events-mode
|
||||||
bool m_delaying_load_events { false };
|
Optional<DOM::DocumentLoadEventDelayer> m_delaying_the_load_event;
|
||||||
|
|
||||||
// Implied link between navigable and its container.
|
// Implied link between navigable and its container.
|
||||||
JS::GCPtr<NavigableContainer> m_container;
|
JS::GCPtr<NavigableContainer> m_container;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue