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