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

LibWeb: Move RoundingMode to Enums.json

In the spec this is a `<rounding-strategy>`, so let's use that name.
This also fixes a bug where we were serializing `to-zero` as
`toward-zero`.
This commit is contained in:
Sam Atkins 2023-07-13 14:51:11 +01:00 committed by Andreas Kling
parent 3194f10ad0
commit e4a2bd7a44
5 changed files with 35 additions and 48 deletions

View file

@ -130,14 +130,6 @@ public:
MinusInfinity,
};
// https://drafts.csswg.org/css-values-4/#round-func
enum class RoundingMode {
Nearest,
Up,
Down,
TowardZero
};
enum class Type {
Numeric,
// NOTE: Currently, any value with a `var()` or `attr()` function in it is always an
@ -699,7 +691,7 @@ private:
class RoundCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<RoundCalculationNode>> create(CalculationNode::RoundingMode, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static ErrorOr<NonnullOwnPtr<RoundCalculationNode>> create(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~RoundCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -712,8 +704,8 @@ public:
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
private:
RoundCalculationNode(RoundingMode, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
CalculationNode::RoundingMode m_mode;
RoundCalculationNode(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
RoundingStrategy m_strategy;
NonnullOwnPtr<CalculationNode> m_x;
NonnullOwnPtr<CalculationNode> m_y;
};