diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 6b466f5bce..0c508932b6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020-2021, Andreas Kling + * Copyright (c) 2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ @@ -59,19 +60,6 @@ void HTMLIFrameElement::inserted() } } -// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#will-lazy-load-element-steps -bool HTMLIFrameElement::will_lazy_load_element() const -{ - // 1. If scripting is disabled for element, then return false. - if (document().is_scripting_disabled()) - return false; - - // FIXME: 2. If element's lazy loading attribute is in the Lazy state, then return true. - - // 3. Return false. - return false; -} - // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes void HTMLIFrameElement::process_the_iframe_attributes(bool initial_insertion) { @@ -188,4 +176,10 @@ i32 HTMLIFrameElement::default_tab_index_value() const return 0; } +void HTMLIFrameElement::visit_edges(Cell::Visitor& visitor) +{ + Base::visit_edges(visitor); + visit_lazy_loading_element(visitor); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index d15e9bbfdc..958e6b7876 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -1,17 +1,23 @@ /* * Copyright (c) 2020-2021, Andreas Kling + * Copyright (c) 2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once +#include #include namespace Web::HTML { -class HTMLIFrameElement final : public NavigableContainer { +class HTMLIFrameElement final + : public NavigableContainer + , public LazyLoadingElement { + WEB_PLATFORM_OBJECT(HTMLIFrameElement, NavigableContainer); + LAZY_LOADING_ELEMENT(HTMLIFrameElement); JS_DECLARE_ALLOCATOR(HTMLIFrameElement); public: @@ -19,9 +25,6 @@ public: virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; - // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#will-lazy-load-element-steps - bool will_lazy_load_element() const; - void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; } Optional const& pending_resource_start_time() const { return m_pending_resource_start_time; } @@ -29,6 +32,8 @@ public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; + virtual void visit_edges(Cell::Visitor&) override; + private: HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);