2021-04-03 11:43:08 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2020-2021, Andreas Kling <andreas@ladybird.org>
|
2021-04-03 11:43:08 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-04-03 11:43:08 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
2023-04-13 18:50:09 +03:00
|
|
|
#include <LibWeb/HTML/Navigable.h>
|
2021-04-03 11:43:08 +02:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2022-12-12 12:20:02 +01:00
|
|
|
class NavigableContainer : public HTMLElement {
|
|
|
|
WEB_PLATFORM_OBJECT(NavigableContainer, HTMLElement);
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2021-04-03 11:43:08 +02:00
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ptr<NavigableContainer> navigable_container_with_content_navigable(GC::Ref<Navigable> navigable);
|
2023-04-23 17:50:08 +03:00
|
|
|
|
2022-12-12 12:20:02 +01:00
|
|
|
virtual ~NavigableContainer() override;
|
2021-04-03 11:43:08 +02:00
|
|
|
|
2022-12-12 12:20:02 +01:00
|
|
|
static HashTable<NavigableContainer*>& all_instances();
|
2022-09-19 20:50:33 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Navigable> content_navigable() { return m_content_navigable; }
|
|
|
|
GC::Ptr<Navigable const> content_navigable() const { return m_content_navigable.ptr(); }
|
2021-04-03 11:43:08 +02:00
|
|
|
|
|
|
|
const DOM::Document* content_document() const;
|
2022-02-16 22:51:25 +00:00
|
|
|
DOM::Document const* content_document_without_origin_check() const;
|
2021-04-03 11:43:08 +02:00
|
|
|
|
2022-11-04 10:05:10 +01:00
|
|
|
HTML::WindowProxy* content_window();
|
2022-08-04 20:13:52 +02:00
|
|
|
|
2022-03-24 22:08:06 +02:00
|
|
|
DOM::Document const* get_svg_document() const;
|
|
|
|
|
2022-12-16 23:28:12 +01:00
|
|
|
void destroy_the_child_navigable();
|
|
|
|
|
2023-11-24 15:52:56 +00:00
|
|
|
// All elements that extend NavigableContainer "potentially delay the load event".
|
|
|
|
// (embed, frame, iframe, and object)
|
|
|
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#potentially-delays-the-load-event
|
|
|
|
bool currently_delays_the_load_event() const;
|
|
|
|
|
2025-02-27 00:22:12 +01:00
|
|
|
bool content_navigable_has_session_history_entry_and_ready_for_navigation() const
|
|
|
|
{
|
|
|
|
if (!content_navigable())
|
|
|
|
return false;
|
|
|
|
return m_content_navigable->has_session_history_entry_and_ready_for_navigation();
|
|
|
|
}
|
2024-04-08 05:36:02 +02:00
|
|
|
|
2021-04-03 11:43:08 +02:00
|
|
|
protected:
|
2022-12-12 12:20:02 +01:00
|
|
|
NavigableContainer(DOM::Document&, DOM::QualifiedName);
|
2022-08-28 13:42:07 +02:00
|
|
|
|
2022-10-17 11:06:50 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2022-09-19 13:34:36 +02:00
|
|
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
|
2024-03-18 16:22:27 +13:00
|
|
|
Optional<URL::URL> shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion);
|
2022-09-19 13:34:36 +02:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#navigate-an-iframe-or-frame
|
2024-03-18 16:22:27 +13:00
|
|
|
void navigate_an_iframe_or_frame(URL::URL url, ReferrerPolicy::ReferrerPolicy referrer_policy, Optional<String> srcdoc_string = {});
|
2022-03-23 20:13:34 -04:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
WebIDL::ExceptionOr<void> create_new_child_navigable(GC::Ptr<GC::Function<void()>> after_session_history_update = {});
|
2023-07-10 21:08:57 +02:00
|
|
|
|
2023-06-21 15:45:41 +03:00
|
|
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#content-navigable
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Navigable> m_content_navigable { nullptr };
|
2023-06-21 15:45:41 +03:00
|
|
|
|
2023-11-24 15:52:56 +00:00
|
|
|
void set_potentially_delays_the_load_event(bool value) { m_potentially_delays_the_load_event = value; }
|
|
|
|
|
2025-02-27 00:22:12 +01:00
|
|
|
void set_content_navigable_has_session_history_entry_and_ready_for_navigation()
|
|
|
|
{
|
|
|
|
if (!content_navigable())
|
|
|
|
return;
|
|
|
|
content_navigable()->set_has_session_history_entry_and_ready_for_navigation();
|
|
|
|
}
|
2024-04-04 18:49:40 +02:00
|
|
|
|
2021-11-24 19:15:04 +03:00
|
|
|
private:
|
2022-12-12 12:20:02 +01:00
|
|
|
virtual bool is_navigable_container() const override { return true; }
|
2023-11-24 15:52:56 +00:00
|
|
|
bool m_potentially_delays_the_load_event { true };
|
2021-04-03 11:43:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2021-11-24 19:15:04 +03:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
|
|
|
template<>
|
2022-12-12 12:20:02 +01:00
|
|
|
inline bool Node::fast_is<HTML::NavigableContainer>() const { return is_navigable_container(); }
|
2021-11-24 19:15:04 +03:00
|
|
|
}
|