HTMLHyperlinkElementUtils.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/URL.h>
  8. #include <LibWeb/Forward.h>
  9. #include <LibWeb/HTML/EventLoop/Task.h>
  10. namespace Web::HTML {
  11. class HTMLHyperlinkElementUtils {
  12. public:
  13. virtual ~HTMLHyperlinkElementUtils();
  14. DeprecatedString origin() const;
  15. DeprecatedString href() const;
  16. void set_href(DeprecatedString);
  17. DeprecatedString protocol() const;
  18. void set_protocol(DeprecatedString);
  19. DeprecatedString username() const;
  20. void set_username(DeprecatedString);
  21. DeprecatedString password() const;
  22. void set_password(DeprecatedString);
  23. DeprecatedString host() const;
  24. void set_host(DeprecatedString);
  25. DeprecatedString hostname() const;
  26. void set_hostname(DeprecatedString);
  27. DeprecatedString port() const;
  28. void set_port(DeprecatedString);
  29. DeprecatedString pathname() const;
  30. void set_pathname(DeprecatedString);
  31. DeprecatedString search() const;
  32. void set_search(DeprecatedString);
  33. DeprecatedString hash() const;
  34. void set_hash(DeprecatedString);
  35. protected:
  36. virtual DOM::Document& hyperlink_element_utils_document() = 0;
  37. virtual DeprecatedString hyperlink_element_utils_href() const = 0;
  38. virtual void set_hyperlink_element_utils_href(DeprecatedString) = 0;
  39. virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
  40. virtual bool hyperlink_element_utils_is_connected() const = 0;
  41. virtual DeprecatedString hyperlink_element_utils_target() const = 0;
  42. virtual DeprecatedString hyperlink_element_utils_rel() const = 0;
  43. virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) = 0;
  44. void set_the_url();
  45. void follow_the_hyperlink(Optional<DeprecatedString> hyperlink_suffix);
  46. private:
  47. void reinitialize_url() const;
  48. void update_href();
  49. bool cannot_navigate() const;
  50. DeprecatedString get_an_elements_target() const;
  51. bool get_an_elements_noopener(StringView target) const;
  52. Optional<AK::URL> m_url;
  53. };
  54. }