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

LibWeb: Add non-const version of paintable_box() in DOM::Node

This commit is contained in:
Aliaksandr Kalenik 2023-08-07 00:59:23 +02:00 committed by Andreas Kling
parent 6868ace8f4
commit c985a1b2af
5 changed files with 16 additions and 6 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));
const_cast<Painting::PaintableBox*>(paintable_box())->set_scroll_offset(scroll_offset);
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));
const_cast<Painting::PaintableBox*>(paintable_box())->set_scroll_offset(scroll_offset);
paintable_box()->set_scroll_offset(scroll_offset);
}
// https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth
@ -1780,7 +1780,7 @@ HashMap<DeprecatedFlyString, CSS::StyleProperty> const& Element::custom_properti
void Element::scroll(double x, double y)
{
// AD-HOC:
const_cast<Painting::PaintableBox*>(paintable_box())->scroll_by(x, y);
paintable_box()->scroll_by(x, y);
}
// https://drafts.csswg.org/cssom-view/#dom-element-scroll