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

LibWeb: Don't crash when querying offsets of empty inline elements

Previously, querying `offsetTop` or `offsetLeft` of an inline element
with no text would cause a crash.
This commit is contained in:
Tim Ledbetter 2024-01-28 20:07:48 +00:00 committed by Alexander Kalenik
parent 99fbd33d7d
commit d1226f0b15
3 changed files with 15 additions and 1 deletions

View file

@ -158,7 +158,7 @@ CSSPixelPoint Paintable::box_type_agnostic_position() const
auto const& inline_paintable = static_cast<Painting::InlinePaintable const&>(*this);
if (!inline_paintable.fragments().is_empty())
return inline_paintable.fragments().first().absolute_rect().location();
VERIFY_NOT_REACHED();
return inline_paintable.bounding_rect().location();
}
CSSPixelPoint position;