LibWeb: Change viewport ownership from BrowsingContext to Navigable

This commit is contained in:
Aliaksandr Kalenik 2023-08-22 16:00:42 +02:00 committed by Andreas Kling
parent 4356d37b2c
commit dd7bba66ed
Notes: sideshowbarker 2024-07-17 01:13:25 +09:00
23 changed files with 196 additions and 129 deletions

View file

@ -173,12 +173,12 @@ CSSPixelRect IntersectionObserver::root_intersection_rectangle() const
if (intersection_root.has<JS::Handle<DOM::Document>>()) {
auto document = intersection_root.get<JS::Handle<DOM::Document>>();
// Since the spec says that this is only reach if the document is fully active, that means it must have a browsing context.
VERIFY(document->browsing_context());
// Since the spec says that this is only reach if the document is fully active, that means it must have a navigable.
VERIFY(document->navigable());
// NOTE: This rect is the *size* of the viewport. The viewport *offset* is not relevant,
// as intersections are computed using viewport-relative element rects.
rect = CSSPixelRect { CSSPixelPoint { 0, 0 }, document->browsing_context()->viewport_rect().size() };
rect = CSSPixelRect { CSSPixelPoint { 0, 0 }, document->viewport_rect().size() };
} else {
VERIFY(intersection_root.has<JS::Handle<DOM::Element>>());
auto element = intersection_root.get<JS::Handle<DOM::Element>>();