1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

LibWeb: Move set_scroll_offset() from Layout::Box to PaintableBox

Nodes in layout tree should not be aware of scroll state.
This commit is contained in:
Aliaksandr Kalenik 2023-08-06 21:10:15 +02:00 committed by Andreas Kling
parent 5b7926fa53
commit fee5b4deb6
5 changed files with 24 additions and 23 deletions

View file

@ -1054,7 +1054,7 @@ void Element::set_scroll_left(double x)
// FIXME: Implement this in terms of calling "scroll the element".
auto scroll_offset = paintable_box()->scroll_offset();
scroll_offset.set_x(static_cast<float>(x));
box->set_scroll_offset(scroll_offset);
const_cast<Painting::PaintableBox*>(paintable_box())->set_scroll_offset(scroll_offset);
}
void Element::set_scroll_top(double y)
@ -1122,7 +1122,7 @@ void Element::set_scroll_top(double y)
// FIXME: Implement this in terms of calling "scroll the element".
auto scroll_offset = paintable_box()->scroll_offset();
scroll_offset.set_y(static_cast<float>(y));
box->set_scroll_offset(scroll_offset);
const_cast<Painting::PaintableBox*>(paintable_box())->set_scroll_offset(scroll_offset);
}
// https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth