LibWeb: Implement Document.rootElement (SVG2 extension to Document)

This commit is contained in:
Andreas Kling 2025-05-09 00:30:40 +02:00 committed by Andreas Kling
commit 879cba762b
Notes: github-actions[bot] 2025-05-16 18:37:14 +00:00
4 changed files with 16 additions and 3 deletions

View file

@ -151,6 +151,7 @@
#include <LibWeb/ResizeObserver/ResizeObserverEntry.h>
#include <LibWeb/SVG/SVGDecodedImageData.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGSVGElement.h>
#include <LibWeb/SVG/SVGStyleElement.h>
#include <LibWeb/SVG/SVGTitleElement.h>
#include <LibWeb/Selection/Selection.h>
@ -892,6 +893,12 @@ Element const* Document::document_element() const
return first_child_of_type<Element>();
}
// https://www.w3.org/TR/SVG2/struct.html#InterfaceDocumentExtensions
GC::Ptr<SVG::SVGSVGElement> Document::root_element()
{
return as_if<SVG::SVGSVGElement>(document_element());
}
// https://html.spec.whatwg.org/multipage/dom.html#the-html-element-2
HTML::HTMLHtmlElement* Document::html_element()
{