LibWeb: Update IntersectionObserver::intersection_root() for navigables

This commit is contained in:
Aliaksandr Kalenik 2023-09-12 19:18:00 +02:00 committed by Andreas Kling
parent 10b2ce49dc
commit 69513de1ad
Notes: sideshowbarker 2024-07-17 08:34:29 +09:00

View File

@ -8,6 +8,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/TraversableNavigable.h>
#include <LibWeb/IntersectionObserver/IntersectionObserver.h>
namespace Web::IntersectionObserver {
@ -155,7 +156,7 @@ Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>, Empty> Intersection
Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>> IntersectionObserver::intersection_root() const
{
if (!m_root.has_value())
return JS::make_handle(global_object().browsing_context()->top_level_browsing_context()->active_document());
return JS::make_handle(global_object().navigable()->traversable_navigable()->active_document());
return m_root.value();
}