From 67559b12797ce41cfce01a61b8eaf974f2bed175 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 21 Sep 2022 00:03:53 +0200 Subject: [PATCH] LibWeb: Add load/unload timing structures to Document We don't populate these with information just yet, but we will soon! --- Userland/Libraries/LibWeb/DOM/Document.h | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index bf54165835..b560d9e7c9 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -42,6 +42,32 @@ enum class QuirksMode { Yes }; +// https://html.spec.whatwg.org/multipage/dom.html#document-load-timing-info +struct DocumentLoadTimingInfo { + // https://html.spec.whatwg.org/multipage/dom.html#navigation-start-time + double navigation_start_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#dom-interactive-time + double dom_interactive_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#dom-content-loaded-event-start-time + double dom_content_loaded_event_start_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#dom-content-loaded-event-end-time + double dom_content_loaded_event_end_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#dom-complete-time + double dom_complete_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#load-event-start-time + double load_event_start_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#load-event-end-time + double load_event_end_time { 0 }; +}; + +// https://html.spec.whatwg.org/multipage/dom.html#document-unload-timing-info +struct DocumentUnloadTimingInfo { + // https://html.spec.whatwg.org/multipage/dom.html#unload-event-start-time + double unload_event_start_time { 0 }; + // https://html.spec.whatwg.org/multipage/dom.html#unload-event-end-time + double unload_event_end_time { 0 }; +}; + class Document : public ParentNode , public NonElementParentNode @@ -397,6 +423,14 @@ public: // https://html.spec.whatwg.org/multipage/dom.html#active-parser RefPtr active_parser(); + // https://html.spec.whatwg.org/multipage/dom.html#load-timing-info + DocumentLoadTimingInfo const& load_timing_info() { return m_load_timing_info; } + void set_load_timing_info(DocumentLoadTimingInfo const& load_timing_info) { m_load_timing_info = load_timing_info; } + + // https://html.spec.whatwg.org/multipage/dom.html#previous-document-unload-timing + DocumentUnloadTimingInfo const& previous_document_unload_timing() { return m_previous_document_unload_timing; } + void set_previous_document_unload_timing(DocumentUnloadTimingInfo const& previous_document_unload_timing) { m_previous_document_unload_timing = previous_document_unload_timing; } + protected: virtual void visit_edges(Cell::Visitor&) override; @@ -546,6 +580,12 @@ private: // https://html.spec.whatwg.org/multipage/interaction.html#visibility-state HTML::VisibilityState m_visibility_state { HTML::VisibilityState::Hidden }; + + // https://html.spec.whatwg.org/multipage/dom.html#load-timing-info + DocumentLoadTimingInfo m_load_timing_info; + + // https://html.spec.whatwg.org/multipage/dom.html#previous-document-unload-timing + DocumentUnloadTimingInfo m_previous_document_unload_timing; }; }