BrowsingContextContainer.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/HTML/HTMLElement.h>
  8. namespace Web::HTML {
  9. class BrowsingContextContainer : public HTMLElement {
  10. WEB_PLATFORM_OBJECT(BrowsingContextContainer, HTMLElement);
  11. public:
  12. virtual ~BrowsingContextContainer() override;
  13. static HashTable<BrowsingContextContainer*>& all_instances();
  14. BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; }
  15. BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; }
  16. const DOM::Document* content_document() const;
  17. DOM::Document const* content_document_without_origin_check() const;
  18. HTML::Window* content_window() const;
  19. DOM::Document const* get_svg_document() const;
  20. protected:
  21. BrowsingContextContainer(DOM::Document&, DOM::QualifiedName);
  22. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
  23. void shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
  24. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
  25. void navigate_an_iframe_or_frame(NonnullRefPtr<Fetch::Infrastructure::Request>);
  26. void create_new_nested_browsing_context();
  27. RefPtr<BrowsingContext> m_nested_browsing_context;
  28. private:
  29. virtual bool is_browsing_context_container() const override { return true; }
  30. };
  31. }
  32. namespace Web::DOM {
  33. template<>
  34. inline bool Node::fast_is<HTML::BrowsingContextContainer>() const { return is_browsing_context_container(); }
  35. }