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

LibWeb: Make Paintable::containing_block() return a PaintableBox*

Every single client of this function was immediately calling paintable()
on the result anyway, so there was no need to return a layout node!

This automatically leverages the cached containing block pointer we
already have in Paintable, which melts away a bunch of unnecessary
traversal in hit testing and painting. :^)
This commit is contained in:
Andreas Kling 2024-03-01 15:30:44 +01:00
parent c3980eda9e
commit d1b5f55f91
9 changed files with 32 additions and 36 deletions

View file

@ -25,8 +25,8 @@ CSSPixelRect const PaintableFragment::absolute_rect() const
{
CSSPixelRect rect { {}, size() };
auto const* containing_block = paintable().containing_block();
if (containing_block && containing_block->paintable_box())
rect.set_location(containing_block->paintable_box()->absolute_position());
if (containing_block)
rect.set_location(containing_block->absolute_position());
rect.translate_by(offset());
return rect;
}