Serenity Operating System
1/*
2 * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <LibWeb/HTML/BrowsingContextContainer.h>
10
11namespace Web::HTML {
12
13class HTMLIFrameElement final : public BrowsingContextContainer {
14 WEB_PLATFORM_OBJECT(HTMLIFrameElement, BrowsingContextContainer);
15
16public:
17 virtual ~HTMLIFrameElement() override;
18
19 virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
20
21 // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#will-lazy-load-element-steps
22 bool will_lazy_load_element() const;
23
24 void set_current_navigation_was_lazy_loaded(bool value) { m_current_navigation_was_lazy_loaded = value; }
25
26 virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
27
28private:
29 HTMLIFrameElement(DOM::Document&, DOM::QualifiedName);
30
31 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
32
33 // ^DOM::Element
34 virtual void inserted() override;
35 virtual void removed_from(Node*) override;
36 virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
37 virtual i32 default_tab_index_value() const override;
38
39 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
40 void process_the_iframe_attributes(bool initial_insertion = false);
41
42 void load_src(DeprecatedString const&);
43
44 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#current-navigation-was-lazy-loaded
45 bool m_current_navigation_was_lazy_loaded { false };
46};
47
48void run_iframe_load_event_steps(HTML::HTMLIFrameElement&);
49
50}