NavigableContainer.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. static JS::GCPtr<NavigableContainer> navigable_container_with_content_navigable(JS::NonnullGCPtr<Navigable> navigable);
  13. virtual ~NavigableContainer() override;
  14. static HashTable<NavigableContainer*>& all_instances();
  15. JS::GCPtr<Navigable> content_navigable() { return m_content_navigable; }
  16. JS::GCPtr<Navigable const> content_navigable() const { return m_content_navigable.ptr(); }
  17. BrowsingContext* nested_browsing_context() { return m_nested_browsing_context; }
  18. BrowsingContext const* nested_browsing_context() const { return m_nested_browsing_context; }
  19. const DOM::Document* content_document() const;
  20. DOM::Document const* content_document_without_origin_check() const;
  21. HTML::WindowProxy* content_window();
  22. DOM::Document const* get_svg_document() const;
  23. void destroy_the_child_navigable();
  24. protected:
  25. NavigableContainer(DOM::Document&, DOM::QualifiedName);
  26. virtual void visit_edges(Cell::Visitor&) override;
  27. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
  28. void shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
  29. // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
  30. void navigate_an_iframe_or_frame(JS::NonnullGCPtr<Fetch::Infrastructure::Request>);
  31. void create_new_nested_browsing_context();
  32. WebIDL::ExceptionOr<void> create_new_child_navigable();
  33. JS::GCPtr<BrowsingContext> m_nested_browsing_context;
  34. // https://html.spec.whatwg.org/multipage/document-sequences.html#content-navigable
  35. JS::GCPtr<Navigable> m_content_navigable { nullptr };
  36. private:
  37. virtual bool is_navigable_container() const override { return true; }
  38. };
  39. }
  40. namespace Web::DOM {
  41. template<>
  42. inline bool Node::fast_is<HTML::NavigableContainer>() const { return is_navigable_container(); }
  43. }