diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 5da2efc583..bba27d94c0 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -135,6 +135,7 @@ class ImageData; namespace Web { class EventHandler; class Frame; +class FrameLoader; class LayoutBlock; class LayoutButton; class LayoutCheckBox; diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 25b79c3c2a..3c1d536c1e 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -86,4 +86,9 @@ const DOM::Document* HTMLIFrameElement::content_document() const return m_content_frame ? m_content_frame->document() : nullptr; } +void HTMLIFrameElement::content_frame_did_load(Badge) +{ + dispatch_event(DOM::Event::create("load")); +} + } diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Libraries/LibWeb/HTML/HTMLIFrameElement.h index ed377d2abf..bff8692b22 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -44,6 +44,8 @@ public: const DOM::Document* content_document() const; + void content_frame_did_load(Badge); + private: virtual void document_did_attach_to_frame(Frame&) override; virtual void document_will_detach_from_frame(Frame&) override; diff --git a/Libraries/LibWeb/Loader/FrameLoader.cpp b/Libraries/LibWeb/Loader/FrameLoader.cpp index 1ef1798e95..ab5f148292 100644 --- a/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -230,6 +231,12 @@ void FrameLoader::resource_did_load() if (!url.fragment().is_empty()) frame().scroll_to_anchor(url.fragment()); + + if (auto* host_element = frame().host_element()) { + // FIXME: Perhaps in the future we'll have a better common base class for and