LibWeb: Expose Node::accessible_name via window.internals

This adds window.internals.getComputedLabel, for exposing
Node::accessible_name (for accessibility-testing purposes).
This commit is contained in:
sideshowbarker 2024-10-30 02:35:14 +09:00 committed by Tim Ledbetter
parent 65bda00274
commit 1b4e609eb2
Notes: github-actions[bot] 2024-10-31 01:17:47 +00:00
3 changed files with 10 additions and 0 deletions

View file

@ -193,4 +193,10 @@ void Internals::expire_cookies_with_time_offset(WebIDL::LongLong seconds)
internals_page().client().page_did_expire_cookies_with_time_offset(AK::Duration::from_seconds(seconds));
}
String Internals::get_computed_label(DOM::Element& element)
{
auto& active_document = internals_window().associated_document();
return MUST(element.accessible_name(active_document));
}
}

View file

@ -47,6 +47,8 @@ public:
void enable_cookies_on_file_domains();
void expire_cookies_with_time_offset(WebIDL::LongLong seconds);
String get_computed_label(DOM::Element& element);
private:
explicit Internals(JS::Realm&);
virtual void initialize(JS::Realm&) override;

View file

@ -36,4 +36,6 @@ interface Internals {
undefined enableCookiesOnFileDomains();
undefined expireCookiesWithTimeOffset(long long seconds);
DOMString getComputedLabel(Element element);
};