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

LibWeb: Store calculated transformation matrix on the StackingContext

This is mainly so we can easily read that matrix later, but also has the
benefit of only calculating the matrix once, instead of every time we
paint. :^)
This commit is contained in:
Sam Atkins 2022-07-19 15:18:20 +01:00 committed by Andreas Kling
parent 01a3f72d39
commit 75e0b21940
2 changed files with 11 additions and 8 deletions

View file

@ -34,19 +34,22 @@ public:
void paint(PaintContext&) const;
Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const;
Gfx::FloatMatrix4x4 const& transform_matrix() const { return m_transform; }
Gfx::AffineTransform affine_transform_matrix() const;
void dump(int indent = 0) const;
void sort();
private:
Layout::Box& m_box;
Gfx::FloatMatrix4x4 m_transform;
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::AffineTransform combine_transformations_2d(Vector<CSS::Transformation> const& transformations) const;
Gfx::FloatPoint transform_origin() const;
};