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

LibWeb: Move scroll state from Layout::BlockContainer to Layout::Box

Let's allow any box to be scrollable, not just block containers.
This commit is contained in:
Andreas Kling 2023-01-23 17:04:24 +01:00
parent 8fe748bb89
commit 3dd006f719
6 changed files with 40 additions and 43 deletions

View file

@ -29,6 +29,21 @@ Box::~Box()
{
}
bool Box::is_scrollable() const
{
// FIXME: Support horizontal scroll as well (overflow-x)
return computed_values().overflow_y() == CSS::Overflow::Scroll;
}
void Box::set_scroll_offset(CSSPixelPoint offset)
{
// FIXME: If there is horizontal and vertical scroll ignore only part of the new offset
if (offset.y() < 0 || m_scroll_offset == offset)
return;
m_scroll_offset = offset;
set_needs_display();
}
void Box::set_needs_display()
{
if (paint_box())