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

LibWeb: Compute StackingContext transform origin only once

When mousing over twitter, 17% of time was spent computing stacking
context transform origins. Since this never changes after the stacking
context is created, we can cache it and avoid all that work.
This commit is contained in:
Andreas Kling 2022-09-24 20:36:06 +02:00
parent 901b80f988
commit 5c6621547c
2 changed files with 5 additions and 2 deletions

View file

@ -44,13 +44,15 @@ public:
private:
Layout::Box& m_box;
Gfx::FloatMatrix4x4 m_transform;
Gfx::FloatPoint m_transform_origin;
StackingContext* const m_parent { nullptr };
Vector<StackingContext*> m_children;
void paint_internal(PaintContext&) const;
Gfx::FloatMatrix4x4 get_transformation_matrix(CSS::Transformation const& transformation) const;
Gfx::FloatMatrix4x4 combine_transformations(Vector<CSS::Transformation> const& transformations) const;
Gfx::FloatPoint transform_origin() const;
Gfx::FloatPoint transform_origin() const { return m_transform_origin; }
Gfx::FloatPoint compute_transform_origin() const;
};
}