LibWeb: Make input widget (buttons, text boxes, etc) scroll with page

We now relayout all LayoutWidgets when the view is scrolled. This will
cause them to follow along with the rest of the page content.
This commit is contained in:
Andreas Kling 2020-06-01 19:50:47 +02:00
commit e58e315e0f
Notes: sideshowbarker 2024-07-19 05:54:33 +09:00
4 changed files with 28 additions and 3 deletions

View file

@ -81,4 +81,18 @@ void Frame::set_needs_display(const Gfx::Rect& rect)
on_set_needs_display(rect);
}
void Frame::did_scroll(Badge<PageView>)
{
if (!m_document)
return;
if (!m_document->layout_node())
return;
m_document->layout_node()->for_each_in_subtree([&](LayoutNode& layout_node) {
if (layout_node.is_widget()) {
layout_node.layout(LayoutNode::LayoutMode::Default);
}
return IterationDecision::Continue;
});
}
}