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:
parent
8fe748bb89
commit
3dd006f719
6 changed files with 40 additions and 43 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue