NavigableContainer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 NavigableContainer : public HTMLElement {
  10. WEB_PLATFORM_OBJECT(NavigableContainer, HTMLElement);
  11. public:
  12. virtual ~NavigableContainer() override;
  13. static HashTable<NavigableContainer*>& 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::WindowProxy* content_window();
  19. DOM::Document const* get_svg_document() const;
  20. protected:
  21. NavigableContainer(DOM::Document&, DOM::QualifiedName);
  22. virtual void visit_edges(Cell::Visitor&) override;
  23. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
  24. void shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
  25. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
  26. void navigate_an_iframe_or_frame(JS::NonnullGCPtr<Fetch::Infrastructure::Request>);
  27. void create_new_nested_browsing_context();
  28. JS::GCPtr<BrowsingContext> m_nested_browsing_context;
  29. private:
  30. virtual bool is_navigable_container() const override { return true; }
  31. };
  32. }
  33. namespace Web::DOM {
  34. template<>
  35. inline bool Node::fast_is<HTML::NavigableContainer>() const { return is_navigable_container(); }
  36. }