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
commit 3dd006f719
Notes: sideshowbarker 2024-07-17 03:03:37 +09:00
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());