Serenity Operating System
at master 55 lines 1.7 kB view raw
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/HTMLElement.h> 10 11namespace Web::HTML { 12 13class BrowsingContextContainer : public HTMLElement { 14 WEB_PLATFORM_OBJECT(BrowsingContextContainer, HTMLElement); 15 16public: 17 virtual ~BrowsingContextContainer() override; 18 19 static HashTable<BrowsingContextContainer*>& all_instances(); 20 21 BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; } 22 BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; } 23 24 const DOM::Document* content_document() const; 25 DOM::Document const* content_document_without_origin_check() const; 26 27 HTML::WindowProxy* content_window(); 28 29 DOM::Document const* get_svg_document() const; 30 31protected: 32 BrowsingContextContainer(DOM::Document&, DOM::QualifiedName); 33 34 virtual void visit_edges(Cell::Visitor&) override; 35 36 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements 37 void shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion); 38 39 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame 40 void navigate_an_iframe_or_frame(JS::NonnullGCPtr<Fetch::Infrastructure::Request>); 41 42 void create_new_nested_browsing_context(); 43 44 JS::GCPtr<BrowsingContext> m_nested_browsing_context; 45 46private: 47 virtual bool is_browsing_context_container() const override { return true; } 48}; 49 50} 51 52namespace Web::DOM { 53template<> 54inline bool Node::fast_is<HTML::BrowsingContextContainer>() const { return is_browsing_context_container(); } 55}