diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 8e4cae9fbfa..fb1eb12dae2 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -171,6 +171,7 @@ public: virtual bool is_html_object_element() const { return false; } virtual bool is_html_form_element() const { return false; } virtual bool is_html_image_element() const { return false; } + virtual bool is_html_iframe_element() const { return false; } virtual bool is_navigable_container() const { return false; } virtual bool is_lazy_loading() const { return false; } diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Libraries/LibWeb/HTML/HTMLIFrameElement.h index cefa15e8e88..2df8ac4ffdf 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -40,6 +40,9 @@ private: virtual void initialize(JS::Realm&) override; + // ^DOM::Node + virtual bool is_html_iframe_element() const override { return true; } + // ^DOM::Element virtual void post_connection() override; virtual void removed_from(Node*) override; diff --git a/Libraries/LibWeb/HTML/Navigable.cpp b/Libraries/LibWeb/HTML/Navigable.cpp index b4566640d06..446573d2a7d 100644 --- a/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Libraries/LibWeb/HTML/Navigable.cpp @@ -1325,11 +1325,18 @@ WebIDL::ExceptionOr Navigable::navigate(NavigateParams params) return {}; } - // FIXME: 9. Let container be navigable's container. - // 10. If container is an iframe element and will lazy load element steps given container returns true, + // 9. Let container be navigable's container. + auto& container = m_container; - // FIXME: 10. If container is an iframe element and will lazy load element steps given container returns true, + // 10. If container is an iframe element and will lazy load element steps given container returns true, // then stop intersection-observing a lazy loading element container and set container's lazy load resumption steps to null. + if (container && container->is_html_iframe_element()) { + auto& iframe_element = static_cast(*container); + if (iframe_element.will_lazy_load_element()) { + iframe_element.document().stop_intersection_observing_a_lazy_loading_element(iframe_element); + iframe_element.set_lazy_load_resumption_steps(nullptr); + } + } // 11. If historyHandling is "auto", then: if (history_handling == Bindings::NavigationHistoryBehavior::Auto) {