1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +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

@ -21,21 +21,6 @@ BlockContainer::BlockContainer(DOM::Document& document, DOM::Node* node, CSS::Co
BlockContainer::~BlockContainer() = default;
bool BlockContainer::is_scrollable() const
{
// FIXME: Support horizontal scroll as well (overflow-x)
return computed_values().overflow_y() == CSS::Overflow::Scroll;
}
void BlockContainer::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();
}
Painting::PaintableWithLines const* BlockContainer::paint_box() const
{
return static_cast<Painting::PaintableWithLines const*>(Box::paint_box());