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

LibWeb: Make CSS Transformation struct a proper class

Move it out of ComputedValues.h into its own files, and take the
transformation-to-matrix code from StackingContext.
This commit is contained in:
Sam Atkins 2023-10-13 17:25:23 +01:00 committed by Andreas Kling
parent 3c49d0dad3
commit 642ad80960
8 changed files with 193 additions and 152 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Matrix4x4.h>
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/CalculatedOr.h>
#include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/PercentageOr.h>
#include <LibWeb/CSS/TransformFunctions.h>
namespace Web::CSS {
using TransformValue = Variant<AngleOrCalculated, LengthPercentage, double>;
class Transformation {
public:
Transformation(TransformFunction function, Vector<TransformValue>&& values);
Gfx::FloatMatrix4x4 to_matrix(Painting::PaintableBox const&) const;
private:
TransformFunction m_function;
Vector<TransformValue> m_values;
};
}