BrowsingContextContainer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; }
  14. BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; }
  15. const DOM::Document* content_document() const;
  16. DOM::Document const* content_document_without_origin_check() const;
  17. HTML::Window* content_window() const;
  18. DOM::Document const* get_svg_document() const;
  19. protected:
  20. BrowsingContextContainer(DOM::Document&, DOM::QualifiedName);
  21. void create_new_nested_browsing_context();
  22. void discard_nested_browsing_context();
  23. RefPtr<BrowsingContext> m_nested_browsing_context;
  24. private:
  25. virtual bool is_browsing_context_container() const override { return true; }
  26. };
  27. }
  28. namespace Web::DOM {
  29. template<>
  30. inline bool Node::fast_is<HTML::BrowsingContextContainer>() const { return is_browsing_context_container(); }
  31. }
  32. WRAPPER_HACK(BrowsingContextContainer, Web::HTML)