HTMLHyperlinkElementUtils.h 2.0 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. #include <LibWeb/HTML/TokenizedFeatures.h>
  11. namespace Web::HTML {
  12. class HTMLHyperlinkElementUtils {
  13. public:
  14. virtual ~HTMLHyperlinkElementUtils();
  15. DeprecatedString origin() const;
  16. DeprecatedString href() const;
  17. WebIDL::ExceptionOr<void> set_href(StringView);
  18. DeprecatedString protocol() const;
  19. void set_protocol(StringView);
  20. DeprecatedString username() const;
  21. void set_username(StringView);
  22. DeprecatedString password() const;
  23. void set_password(StringView);
  24. DeprecatedString host() const;
  25. void set_host(StringView);
  26. DeprecatedString hostname() const;
  27. void set_hostname(StringView);
  28. DeprecatedString port() const;
  29. void set_port(StringView);
  30. DeprecatedString pathname() const;
  31. void set_pathname(StringView);
  32. DeprecatedString search() const;
  33. void set_search(StringView);
  34. DeprecatedString hash() const;
  35. void set_hash(StringView);
  36. protected:
  37. virtual DOM::Document& hyperlink_element_utils_document() = 0;
  38. virtual DeprecatedString hyperlink_element_utils_href() const = 0;
  39. virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) = 0;
  40. virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
  41. virtual bool hyperlink_element_utils_is_connected() const = 0;
  42. virtual DeprecatedString hyperlink_element_utils_get_an_elements_target() const = 0;
  43. virtual TokenizedFeature::NoOpener hyperlink_element_utils_get_an_elements_noopener(StringView target) const = 0;
  44. virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) = 0;
  45. void set_the_url();
  46. void follow_the_hyperlink(Optional<DeprecatedString> hyperlink_suffix);
  47. private:
  48. void reinitialize_url() const;
  49. void update_href();
  50. bool cannot_navigate() const;
  51. Optional<AK::URL> m_url;
  52. };
  53. }