mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
LibWeb: Bring handling of anchor elements closer to spec
This commit moves the regular handling of links to the anchor elements' activation behavior, and implements a few auxiliary algorithms as defined by the HTML specification. Note that certain things such as javascript links, fragments and opening a new tab are still handled directly in EventHandler, but they have been moved to handle_mouseup so that it behaves closer to how it would if it was entirely up-to-spec.
This commit is contained in:
parent
034c57f1f9
commit
aaa954f900
8 changed files with 357 additions and 40 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/URL.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -48,15 +49,23 @@ public:
|
|||
void set_hash(String);
|
||||
|
||||
protected:
|
||||
virtual DOM::Document const& hyperlink_element_utils_document() const = 0;
|
||||
virtual DOM::Document& hyperlink_element_utils_document() = 0;
|
||||
virtual String hyperlink_element_utils_href() const = 0;
|
||||
virtual void set_hyperlink_element_utils_href(String) = 0;
|
||||
virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
|
||||
virtual bool hyperlink_element_utils_is_connected() const = 0;
|
||||
virtual String hyperlink_element_utils_target() const = 0;
|
||||
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) = 0;
|
||||
|
||||
void set_the_url();
|
||||
void follow_the_hyperlink(Optional<String> hyperlink_suffix);
|
||||
|
||||
private:
|
||||
void reinitialize_url() const;
|
||||
void update_href();
|
||||
bool cannot_navigate() const;
|
||||
String get_an_elements_target() const;
|
||||
bool get_an_elements_noopener(StringView target) const;
|
||||
|
||||
Optional<AK::URL> m_url;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue