LibWeb/HTML: Implement the Origin interface

See: 68909b2
This commit is contained in:
Shannon Booth 2025-12-07 14:19:54 +01:00 committed by Jelle Raaijmakers
parent 2c11e03582
commit f9a996650b
Notes: github-actions[bot] 2025-12-30 11:41:25 +00:00
45 changed files with 770 additions and 1 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2024, Shannon Booth <shannon@ladybird.org>
* Copyright (c) 2024-2025, Shannon Booth <shannon@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -524,4 +524,15 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
MUST(target_navigable->navigate({ .url = url.release_value(), .source_document = hyperlink_element_utils_document(), .referrer_policy = referrer_policy, .user_involvement = user_involvement }));
}
// https://html.spec.whatwg.org/multipage/links.html#api-for-a-and-area-elements:extract-an-origin
Optional<URL::Origin> HTMLHyperlinkElementUtils::hyperlink_element_utils_extract_an_origin() const
{
// 1. If this's url is null, then return null.
if (!m_url.has_value())
return {};
// 2. Return this's url's origin.
return m_url->origin();
}
}