mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Implement HTMLAreaElement.referrerPolicy
This commit is contained in:
parent
64eadab181
commit
8f2cb6755b
Notes:
sideshowbarker
2024-07-17 05:02:42 +09:00
Author: https://github.com/jamierocks Commit: https://github.com/LadybirdBrowser/ladybird/commit/8f2cb6755b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/23
@ -61,6 +61,11 @@ WebIDL::ExceptionOr<void> HTMLAnchorElement::set_hyperlink_element_utils_href(St
|
||||
return set_attribute(HTML::AttributeNames::href, move(href));
|
||||
}
|
||||
|
||||
Optional<String> HTMLAnchorElement::hyperlink_element_utils_referrerpolicy() const
|
||||
{
|
||||
return attribute(HTML::AttributeNames::referrerpolicy);
|
||||
}
|
||||
|
||||
bool HTMLAnchorElement::has_activation_behavior() const
|
||||
{
|
||||
return true;
|
||||
|
@ -52,6 +52,7 @@ private:
|
||||
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
|
||||
virtual Optional<String> hyperlink_element_utils_href() const override;
|
||||
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) override;
|
||||
virtual Optional<String> hyperlink_element_utils_referrerpolicy() const override;
|
||||
virtual bool hyperlink_element_utils_is_html_anchor_element() const final { return true; }
|
||||
virtual bool hyperlink_element_utils_is_connected() const final { return is_connected(); }
|
||||
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override
|
||||
|
@ -63,6 +63,11 @@ WebIDL::ExceptionOr<void> HTMLAreaElement::set_hyperlink_element_utils_href(Stri
|
||||
return set_attribute(HTML::AttributeNames::href, move(href));
|
||||
}
|
||||
|
||||
Optional<String> HTMLAreaElement::hyperlink_element_utils_referrerpolicy() const
|
||||
{
|
||||
return attribute(HTML::AttributeNames::referrerpolicy);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
|
||||
i32 HTMLAreaElement::default_tab_index_value() const
|
||||
{
|
||||
|
@ -36,6 +36,7 @@ private:
|
||||
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
|
||||
virtual Optional<String> hyperlink_element_utils_href() const override;
|
||||
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) override;
|
||||
virtual Optional<String> hyperlink_element_utils_referrerpolicy() const override;
|
||||
virtual bool hyperlink_element_utils_is_html_anchor_element() const override { return false; }
|
||||
virtual bool hyperlink_element_utils_is_connected() const override { return is_connected(); }
|
||||
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override
|
||||
|
@ -1,3 +1,4 @@
|
||||
#import <Fetch/Request.idl>
|
||||
#import <HTML/HTMLElement.idl>
|
||||
#import <HTML/HTMLHyperlinkElementUtils.idl>
|
||||
|
||||
@ -15,7 +16,7 @@ interface HTMLAreaElement : HTMLElement {
|
||||
[CEReactions, Reflect] attribute USVString ping;
|
||||
[CEReactions, Reflect] attribute DOMString rel;
|
||||
[SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
|
||||
[FIXME, CEReactions] attribute DOMString referrerPolicy;
|
||||
[CEReactions, Reflect=referrerpolicy, Enumerated=ReferrerPolicy] attribute DOMString referrerPolicy;
|
||||
|
||||
// Obsolete
|
||||
[Reflect=nohref] attribute boolean noHref;
|
||||
|
@ -515,9 +515,10 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
|
||||
url_string = MUST(url_builder.to_string());
|
||||
}
|
||||
|
||||
// FIXME: 11. Let referrerPolicy be the current state of subject's referrerpolicy content attribute.
|
||||
// 11. Let referrerPolicy be the current state of subject's referrerpolicy content attribute.
|
||||
auto referrer_policy = ReferrerPolicy::from_string(hyperlink_element_utils_referrerpolicy().value_or({})).value_or(ReferrerPolicy::ReferrerPolicy::EmptyString);
|
||||
|
||||
// FIXME: 12. If subject's link types includes the noreferrer keyword, then set referrerPolicy to "no-referrer".
|
||||
auto const referrer_policy = ReferrerPolicy::ReferrerPolicy::EmptyString;
|
||||
|
||||
// 13. Navigate targetNavigable to urlString using subject's node document, with referrerPolicy set to referrerPolicy and userInvolvement set to userInvolvement.
|
||||
MUST(target_navigable->navigate({ .url = url_string, .source_document = hyperlink_element_utils_document(), .referrer_policy = referrer_policy, .user_involvement = user_involvement }));
|
||||
|
@ -54,6 +54,7 @@ protected:
|
||||
virtual DOM::Document& hyperlink_element_utils_document() = 0;
|
||||
virtual Optional<String> hyperlink_element_utils_href() const = 0;
|
||||
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) = 0;
|
||||
virtual Optional<String> hyperlink_element_utils_referrerpolicy() const = 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_get_an_elements_target() const = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user