mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibWeb: Let paintables cache their containing block and absolute rect
The absolute rect of a paintable is somewhat expensive to compute. This is because all coordinates are relative to the nearest containing block, so we have to traverse the containing block chain and apply each offset to get the final rect. Paintables will never move between containing blocks, nor will their absolute rect change. If anything changes, we'll simpl make a new paintable and replace the old one. Take advantage of this by caching the containing block and absolute rect after first access.
This commit is contained in:
parent
a54fdd5212
commit
b14c6eaef3
5 changed files with 22 additions and 9 deletions
|
@ -131,6 +131,8 @@ private:
|
|||
Painting::BorderRadiusData normalized_border_radius_data() const;
|
||||
|
||||
OwnPtr<Painting::StackingContext> m_stacking_context;
|
||||
|
||||
Optional<Gfx::FloatRect> mutable m_absolute_rect;
|
||||
};
|
||||
|
||||
class PaintableWithLines : public PaintableBox {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue