mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb/HTML: Start implementing the download attribute
This commit is contained in:
parent
85356094b5
commit
20376adbc3
Notes:
github-actions[bot]
2024-10-27 09:36:48 +00:00
Author: https://github.com/ChaseKnowlden
Commit: 20376adbc3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1992
2 changed files with 9 additions and 1 deletions
|
@ -119,8 +119,10 @@ void HTMLAnchorElement::activation_behavior(Web::DOM::Event const& event)
|
||||||
// 4. Let userInvolvement be event's user navigation involvement.
|
// 4. Let userInvolvement be event's user navigation involvement.
|
||||||
auto user_involvement = user_navigation_involvement(event);
|
auto user_involvement = user_navigation_involvement(event);
|
||||||
|
|
||||||
// FIXME: 5. If the user has expressed a preference to download the hyperlink, then set userInvolvement to "browser UI".
|
// 5. If the user has expressed a preference to download the hyperlink, then set userInvolvement to "browser UI".
|
||||||
// NOTE: That is, if the user has expressed a specific preference for downloading, this no longer counts as merely "activation".
|
// NOTE: That is, if the user has expressed a specific preference for downloading, this no longer counts as merely "activation".
|
||||||
|
if (has_download_preference())
|
||||||
|
user_involvement = UserNavigationInvolvement::BrowserUI;
|
||||||
|
|
||||||
// FIXME: 6. If element has a download attribute, or if the user has expressed a preference to download the
|
// FIXME: 6. If element has a download attribute, or if the user has expressed a preference to download the
|
||||||
// hyperlink, then download the hyperlink created by element with hyperlinkSuffix set to hyperlinkSuffix and
|
// hyperlink, then download the hyperlink created by element with hyperlinkSuffix set to hyperlinkSuffix and
|
||||||
|
@ -130,6 +132,11 @@ void HTMLAnchorElement::activation_behavior(Web::DOM::Event const& event)
|
||||||
follow_the_hyperlink(hyperlink_suffix, user_involvement);
|
follow_the_hyperlink(hyperlink_suffix, user_involvement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HTMLAnchorElement::has_download_preference() const
|
||||||
|
{
|
||||||
|
return has_attribute(HTML::AttributeNames::download);
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
|
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
|
||||||
i32 HTMLAnchorElement::default_tab_index_value() const
|
i32 HTMLAnchorElement::default_tab_index_value() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,7 @@ private:
|
||||||
|
|
||||||
virtual bool has_activation_behavior() const override;
|
virtual bool has_activation_behavior() const override;
|
||||||
virtual void activation_behavior(Web::DOM::Event const&) override;
|
virtual void activation_behavior(Web::DOM::Event const&) override;
|
||||||
|
virtual bool has_download_preference() const;
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^DOM::Element
|
||||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue