LibWeb: Implement getting "inclusive ancestor navigables" of a document

This commit is contained in:
Aliaksandr Kalenik 2023-08-20 00:41:55 +02:00 committed by Andreas Kling
parent e211f6c925
commit 01cc14714e
Notes: sideshowbarker 2024-07-17 11:34:34 +09:00
2 changed files with 14 additions and 0 deletions

View file

@ -2584,6 +2584,19 @@ Vector<JS::Handle<HTML::Navigable>> Document::ancestor_navigables()
return ancestors;
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#inclusive-ancestor-navigables
Vector<JS::Handle<HTML::Navigable>> Document::inclusive_ancestor_navigables()
{
// 1. Let navigables be document's ancestor navigables.
auto navigables = ancestor_navigables();
// 2. Append document's node navigable to navigables.
navigables.append(*navigable());
// 3. Return navigables.
return navigables;
}
// https://html.spec.whatwg.org/multipage/browsers.html#list-of-the-descendant-browsing-contexts
Vector<JS::Handle<HTML::BrowsingContext>> Document::list_of_descendant_browsing_contexts() const
{

View file

@ -463,6 +463,7 @@ public:
Vector<JS::Handle<HTML::Navigable>> descendant_navigables();
Vector<JS::Handle<HTML::Navigable>> inclusive_descendant_navigables();
Vector<JS::Handle<HTML::Navigable>> ancestor_navigables();
Vector<JS::Handle<HTML::Navigable>> inclusive_ancestor_navigables();
void destroy();