2021-10-03 19:39:12 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
|
2021-10-03 19:39:12 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
#include <LibURL/URL.h>
|
2021-10-03 19:39:12 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
2022-03-15 14:37:58 +00:00
|
|
|
#include <LibWeb/HTML/EventLoop/Task.h>
|
2024-01-18 12:57:12 -07:00
|
|
|
#include <LibWeb/HTML/Navigable.h>
|
2023-03-21 06:52:29 -04:00
|
|
|
#include <LibWeb/HTML/TokenizedFeatures.h>
|
2021-10-03 19:39:12 +02:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class HTMLHyperlinkElementUtils {
|
|
|
|
public:
|
|
|
|
virtual ~HTMLHyperlinkElementUtils();
|
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String origin() const;
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String href() const;
|
2023-10-08 11:42:00 +13:00
|
|
|
WebIDL::ExceptionOr<void> set_href(String);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String protocol() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_protocol(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String username() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_username(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String password() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_password(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String host() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_host(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String hostname() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_hostname(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String port() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_port(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String pathname() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_pathname(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String search() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_search(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2023-11-20 13:34:37 +13:00
|
|
|
String hash() const;
|
2023-09-03 15:36:00 +12:00
|
|
|
void set_hash(StringView);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
|
|
|
protected:
|
2022-03-15 14:37:58 +00:00
|
|
|
virtual DOM::Document& hyperlink_element_utils_document() = 0;
|
2024-11-06 18:00:18 +01:00
|
|
|
virtual DOM::Element& hyperlink_element_utils_element() = 0;
|
2023-10-10 15:00:58 +03:30
|
|
|
virtual Optional<String> hyperlink_element_utils_href() const = 0;
|
2023-10-08 11:42:00 +13:00
|
|
|
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) = 0;
|
2024-05-31 21:35:51 +01:00
|
|
|
virtual Optional<String> hyperlink_element_utils_referrerpolicy() const = 0;
|
2022-03-15 14:37:58 +00:00
|
|
|
virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
|
|
|
|
virtual bool hyperlink_element_utils_is_connected() const = 0;
|
2025-01-29 16:48:10 +00:00
|
|
|
virtual String hyperlink_element_utils_get_an_elements_target(Optional<String> target = {}) const = 0;
|
2025-01-29 16:56:55 +00:00
|
|
|
virtual TokenizedFeature::NoOpener hyperlink_element_utils_get_an_elements_noopener(URL::URL const& url, StringView target) const = 0;
|
2023-06-18 16:22:10 +01:00
|
|
|
|
2022-03-15 14:37:58 +00:00
|
|
|
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) = 0;
|
2021-10-03 19:39:12 +02:00
|
|
|
|
|
|
|
void set_the_url();
|
2024-01-18 12:57:12 -07:00
|
|
|
void follow_the_hyperlink(Optional<String> hyperlink_suffix, UserNavigationInvolvement = UserNavigationInvolvement::None);
|
2021-10-03 19:39:12 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void reinitialize_url() const;
|
|
|
|
void update_href();
|
2022-03-15 14:37:58 +00:00
|
|
|
bool cannot_navigate() const;
|
2021-10-03 19:39:12 +02:00
|
|
|
|
2024-03-18 16:22:27 +13:00
|
|
|
Optional<URL::URL> m_url;
|
2021-10-03 19:39:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|