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