/src/serenity/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <AK/HashMap.h> |
10 | | #include <AK/NonnullRefPtr.h> |
11 | | #include <AK/WeakPtr.h> |
12 | | #include <LibJS/Heap/Cell.h> |
13 | | #include <LibWeb/Forward.h> |
14 | | |
15 | | namespace Web::HTML { |
16 | | |
17 | | class BrowsingContextGroup final : public JS::Cell { |
18 | | JS_CELL(BrowsingContextGroup, JS::Cell); |
19 | | JS_DECLARE_ALLOCATOR(BrowsingContextGroup); |
20 | | |
21 | | public: |
22 | | struct BrowsingContextGroupAndDocument { |
23 | | JS::NonnullGCPtr<HTML::BrowsingContextGroup> browsing_context; |
24 | | JS::NonnullGCPtr<DOM::Document> document; |
25 | | }; |
26 | | static WebIDL::ExceptionOr<BrowsingContextGroupAndDocument> create_a_new_browsing_context_group_and_document(JS::NonnullGCPtr<Page>); |
27 | | |
28 | | ~BrowsingContextGroup(); |
29 | | |
30 | 0 | Page& page() { return m_page; } |
31 | 0 | Page const& page() const { return m_page; } |
32 | | |
33 | 0 | auto& browsing_context_set() { return m_browsing_context_set; } |
34 | 0 | auto const& browsing_context_set() const { return m_browsing_context_set; } |
35 | | |
36 | | void append(BrowsingContext&); |
37 | | |
38 | | private: |
39 | | explicit BrowsingContextGroup(JS::NonnullGCPtr<Web::Page>); |
40 | | |
41 | | virtual void visit_edges(Cell::Visitor&) override; |
42 | | |
43 | | // https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set |
44 | | OrderedHashTable<JS::NonnullGCPtr<BrowsingContext>> m_browsing_context_set; |
45 | | |
46 | | JS::NonnullGCPtr<Page> m_page; |
47 | | }; |
48 | | |
49 | | } |