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

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
23 changed files with 196 additions and 129 deletions

View file

@ -63,8 +63,11 @@ bool Box::is_user_scrollable() const
void Box::set_needs_display()
{
if (!navigable())
return;
if (paintable_box())
browsing_context().set_needs_display(paintable_box()->absolute_rect());
navigable()->set_needs_display(paintable_box()->absolute_rect());
}
bool Box::is_body() const

View file

@ -32,8 +32,8 @@ void FrameBox::did_set_content_size()
{
ReplacedBox::did_set_content_size();
VERIFY(dom_node().nested_browsing_context());
dom_node().nested_browsing_context()->set_size(paintable_box()->content_size());
VERIFY(dom_node().content_navigable());
dom_node().content_navigable()->set_size(paintable_box()->content_size());
}
JS::GCPtr<Painting::Paintable> FrameBox::create_paintable() const

View file

@ -196,6 +196,11 @@ HTML::BrowsingContext& Node::browsing_context()
return *m_browsing_context;
}
JS::GCPtr<HTML::Navigable> Node::navigable() const
{
return document().navigable();
}
Viewport const& Node::root() const
{
VERIFY(document().layout_node());
@ -219,7 +224,8 @@ void Node::set_needs_display()
return;
static_cast<Painting::PaintableWithLines const&>(*containing_block->paintable_box()).for_each_fragment([&](auto& fragment) {
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
browsing_context().set_needs_display(fragment.absolute_rect());
if (navigable())
navigable()->set_needs_display(fragment.absolute_rect());
}
return IterationDecision::Continue;
});

View file

@ -77,6 +77,8 @@ public:
HTML::BrowsingContext const& browsing_context() const;
HTML::BrowsingContext& browsing_context();
JS::GCPtr<HTML::Navigable> navigable() const;
Viewport const& root() const;
Viewport& root();