2022-09-19 12:28:46 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/HashMap.h>
|
|
|
|
#include <AK/NonnullRefPtr.h>
|
2023-02-25 10:42:45 -07:00
|
|
|
#include <AK/WeakPtr.h>
|
2022-10-17 11:06:50 +02:00
|
|
|
#include <LibJS/Heap/Cell.h>
|
2022-09-19 12:28:46 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2022-10-17 11:06:50 +02:00
|
|
|
class BrowsingContextGroup final : public JS::Cell {
|
|
|
|
JS_CELL(BrowsingContextGroup, JS::Cell);
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DECLARE_ALLOCATOR(BrowsingContextGroup);
|
2022-10-17 11:06:50 +02:00
|
|
|
|
2022-09-19 12:28:46 +02:00
|
|
|
public:
|
2022-12-17 14:26:48 +01:00
|
|
|
struct BrowsingContextGroupAndDocument {
|
|
|
|
JS::NonnullGCPtr<HTML::BrowsingContextGroup> browsing_context;
|
|
|
|
JS::NonnullGCPtr<DOM::Document> document;
|
|
|
|
};
|
2023-12-03 16:56:04 +13:00
|
|
|
static WebIDL::ExceptionOr<BrowsingContextGroupAndDocument> create_a_new_browsing_context_group_and_document(JS::NonnullGCPtr<Page>);
|
2022-12-17 14:26:48 +01:00
|
|
|
|
2022-09-19 12:28:46 +02:00
|
|
|
~BrowsingContextGroup();
|
|
|
|
|
|
|
|
Page* page() { return m_page; }
|
|
|
|
Page const* page() const { return m_page; }
|
|
|
|
|
|
|
|
auto& browsing_context_set() { return m_browsing_context_set; }
|
|
|
|
auto const& browsing_context_set() const { return m_browsing_context_set; }
|
|
|
|
|
|
|
|
void append(BrowsingContext&);
|
|
|
|
|
|
|
|
private:
|
2023-12-03 16:56:04 +13:00
|
|
|
explicit BrowsingContextGroup(JS::NonnullGCPtr<Web::Page>);
|
2022-09-19 12:28:46 +02:00
|
|
|
|
2022-10-17 11:06:50 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2022-09-19 12:28:46 +02:00
|
|
|
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set
|
2023-04-20 16:44:54 +01:00
|
|
|
OrderedHashTable<JS::NonnullGCPtr<BrowsingContext>> m_browsing_context_set;
|
2022-09-19 12:28:46 +02:00
|
|
|
|
2023-06-26 06:56:54 +02:00
|
|
|
JS::NonnullGCPtr<Page> m_page;
|
2022-09-19 12:28:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|