1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibWeb: Implement basic version of CSSOM View's VisualViewport

We got some errors while loading https://twinings.co.uk/ about this
interface missing, and it looked fairly simple so I sketched it out.
Note that I did leave some FIXMEs where it's not clear exactly which
metrics we should be returning.
This commit is contained in:
Andreas Kling 2023-06-17 16:40:35 +02:00
parent 2a914a7a59
commit 9f6ceff7cf
13 changed files with 257 additions and 2 deletions

View file

@ -21,6 +21,7 @@
#include <LibWeb/CSS/MediaQueryList.h>
#include <LibWeb/CSS/MediaQueryListEvent.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/VisualViewport.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/DOM/Attr.h>
#include <LibWeb/DOM/Comment.h>
@ -2807,6 +2808,13 @@ HTML::ListOfAvailableImages const& Document::list_of_available_images() const
return *m_list_of_available_images;
}
JS::NonnullGCPtr<CSS::VisualViewport> Document::visual_viewport()
{
if (!m_visual_viewport)
m_visual_viewport = CSS::VisualViewport::create(*this).release_value_but_fixme_should_propagate_errors();
return *m_visual_viewport;
}
void Document::register_intersection_observer(Badge<IntersectionObserver::IntersectionObserver>, IntersectionObserver::IntersectionObserver& observer)
{
auto result = m_intersection_observers.set(observer);