diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index 2d074e06b6c..f0f30d67c4a 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -3798,7 +3798,9 @@ RefPtr Parser::parse_calculated_value(ComponentValue const& // The scale family of functions treats percentages as numbers. if (function.name.is_one_of_ignoring_ascii_case( "scale"sv, "scalex"sv, "scaley"sv, "scalez"sv, "scale3d"sv)) { - return CalculationContext { .percentages_resolve_as = ValueType::Number }; + // NOTE: Resolving percentages as numbers isn't supported by the spec and we instead expect the + // caller to handle the resolved value being a percentage. + return CalculationContext {}; } // FIXME: Add other functions that provide a context for resolving values return {}; diff --git a/Libraries/LibWeb/CSS/Transformation.cpp b/Libraries/LibWeb/CSS/Transformation.cpp index dcf340c1693..6ec49c02501 100644 --- a/Libraries/LibWeb/CSS/Transformation.cpp +++ b/Libraries/LibWeb/CSS/Transformation.cpp @@ -43,7 +43,7 @@ ErrorOr Transformation::to_matrix(Optionalresolves_to_length()) { - if (auto const& resolved = value.calculated()->resolve_length_deprecated(context); resolved->is_absolute()) + if (auto const& resolved = value.calculated()->resolve_length(context); resolved.has_value() && resolved->is_absolute()) return resolved->absolute_length_to_px().to_float(); } return Error::from_string_literal("Transform contains non absolute units"); @@ -55,9 +55,11 @@ ErrorOr Transformation::to_matrix(Optionalresolves_to_number()) - return value.calculated()->resolve_number_deprecated(context).value(); + if (auto resolved_number = value.calculated()->resolve_number(context); resolved_number.has_value()) + return resolved_number.value(); if (value.calculated()->resolves_to_percentage()) - return value.calculated()->resolve_percentage_deprecated(context)->as_fraction(); + if (auto resolved_percentage = value.calculated()->resolve_percentage(context); resolved_percentage.has_value()) + return resolved_percentage->as_fraction(); } return Error::from_string_literal("Transform contains non absolute units"); }); diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt index 2aac71cd3f7..548a47ee7e4 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/geometry/DOMMatrix-001.txt @@ -2,8 +2,8 @@ Harness status: OK Found 138 tests -132 Pass -6 Fail +134 Pass +4 Fail Pass new DOMMatrix() Pass new DOMMatrix(undefined) Pass new DOMMatrix(new DOMMatrix()) @@ -47,7 +47,7 @@ Pass new DOMMatrix("translateX(5vi)") Pass new DOMMatrix("translateX(5vmin)") Pass new DOMMatrix("translateX(5vmax)") Pass new DOMMatrix("translateX(5%)") -Fail new DOMMatrix("translateX(calc(10px * sign(1em - 10px)))") +Pass new DOMMatrix("translateX(calc(10px * sign(1em - 10px)))") Pass new DOMMatrix("translateX(calc(10px * sibling-index()))") Pass new DOMMatrix("rotate(5)") Pass new DOMMatrix("rotate(5, 5, 5)") @@ -116,7 +116,7 @@ Pass new DOMMatrixReadOnly("translateX(5vi)") Pass new DOMMatrixReadOnly("translateX(5vmin)") Pass new DOMMatrixReadOnly("translateX(5vmax)") Pass new DOMMatrixReadOnly("translateX(5%)") -Fail new DOMMatrixReadOnly("translateX(calc(10px * sign(1em - 10px)))") +Pass new DOMMatrixReadOnly("translateX(calc(10px * sign(1em - 10px)))") Pass new DOMMatrixReadOnly("translateX(calc(10px * sibling-index()))") Pass new DOMMatrixReadOnly("rotate(5)") Pass new DOMMatrixReadOnly("rotate(5, 5, 5)")