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

LibWeb: Don't const_cast layout_box() when calling const functions

layout_box() already has a non-const overload, so we don't need to
const_cast them anymore. This gets rid of 2 FIXMEs. :^)
This commit is contained in:
Matt Purnell 2022-12-17 19:24:02 -06:00 committed by Andreas Kling
parent 28ad49bcbd
commit 0bda06c9c5

View file

@ -58,15 +58,13 @@ PaintableWithLines::~PaintableWithLines()
void PaintableBox::set_offset(CSSPixelPoint offset) void PaintableBox::set_offset(CSSPixelPoint offset)
{ {
m_offset = offset; m_offset = offset;
// FIXME: This const_cast is gross. layout_box().did_set_rect();
const_cast<Layout::Box&>(layout_box()).did_set_rect();
} }
void PaintableBox::set_content_size(CSSPixelSize size) void PaintableBox::set_content_size(CSSPixelSize size)
{ {
m_content_size = size; m_content_size = size;
// FIXME: This const_cast is gross. layout_box().did_set_rect();
const_cast<Layout::Box&>(layout_box()).did_set_rect();
} }
CSSPixelPoint PaintableBox::effective_offset() const CSSPixelPoint PaintableBox::effective_offset() const
@ -647,7 +645,7 @@ bool PaintableWithLines::handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, u
return false; return false;
auto new_offset = layout_box().scroll_offset(); auto new_offset = layout_box().scroll_offset();
new_offset.translate_by(wheel_delta_x, wheel_delta_y); new_offset.translate_by(wheel_delta_x, wheel_delta_y);
const_cast<Layout::BlockContainer&>(layout_box()).set_scroll_offset(new_offset); layout_box().set_scroll_offset(new_offset);
return true; return true;
} }