summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-03 19:39:12 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-03 21:31:46 +0200
commita7a3f41f6714a6348086bbeb951ab42457d9ef9b (patch)
treed9761ad71e64648fc27787ddb1a24f9668749732 /Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
parente5b85447625088375b6e92dfefbe696246a1626c (diff)
downloadserenity-a7a3f41f6714a6348086bbeb951ab42457d9ef9b.zip
LibWeb: Implement the HTMLHyperlinkElementUtils mixin
This is used by HTMLAnchorElement and HTMLAreaElement to share functionality related to their href attribute.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
new file mode 100644
index 0000000000..75f2e5f49f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHyperlinkElementUtils.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/URL.h>
+#include <LibWeb/Forward.h>
+
+namespace Web::HTML {
+
+class HTMLHyperlinkElementUtils {
+public:
+ virtual ~HTMLHyperlinkElementUtils();
+
+ String origin() const;
+
+ String href() const;
+ void set_href(String);
+
+ String protocol() const;
+ void set_protocol(String);
+
+ String username() const;
+ void set_username(String);
+
+ String password() const;
+ void set_password(String);
+
+ String host() const;
+ void set_host(String);
+
+ String hostname() const;
+ void set_hostname(String);
+
+ String port() const;
+ void set_port(String);
+
+ String pathname() const;
+ void set_pathname(String);
+
+ String search() const;
+ void set_search(String);
+
+ String hash() const;
+ void set_hash(String);
+
+protected:
+ virtual DOM::Document const& hyperlink_element_utils_document() const = 0;
+ virtual String hyperlink_element_utils_href() const = 0;
+ virtual void set_hyperlink_element_utils_href(String) = 0;
+
+ void set_the_url();
+
+private:
+ void reinitialize_url() const;
+ void update_href();
+
+ Optional<AK::URL> m_url;
+};
+
+}