summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/NavigableContainer.h
blob: 3292636b6af2a2d777a66a473f7c1def18b61f3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/HTML/HTMLElement.h>

namespace Web::HTML {

class NavigableContainer : public HTMLElement {
    WEB_PLATFORM_OBJECT(NavigableContainer, HTMLElement);

public:
    virtual ~NavigableContainer() override;

    static HashTable<NavigableContainer*>& all_instances();

    BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; }
    BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; }

    const DOM::Document* content_document() const;
    DOM::Document const* content_document_without_origin_check() const;

    HTML::WindowProxy* content_window();

    DOM::Document const* get_svg_document() const;

protected:
    NavigableContainer(DOM::Document&, DOM::QualifiedName);

    virtual void visit_edges(Cell::Visitor&) override;

    // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
    void shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);

    // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
    void navigate_an_iframe_or_frame(JS::NonnullGCPtr<Fetch::Infrastructure::Request>);

    void create_new_nested_browsing_context();

    JS::GCPtr<BrowsingContext> m_nested_browsing_context;

private:
    virtual bool is_navigable_container() const override { return true; }
};

}

namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::NavigableContainer>() const { return is_navigable_container(); }
}