Skip to content

Truly independent web browser

LibWeb: Lowercase the canonical unit of a Typed OM sum value

Andreas Kling31b67d98925c
diff --git a/Libraries/LibWeb/Rust/src/css/typed_om.rs b/Libraries/LibWeb/Rust/src/css/typed_om.rs
index e0534a2a94b..19e32e694d9 100644
--- a/Libraries/LibWeb/Rust/src/css/typed_om.rs
+++ b/Libraries/LibWeb/Rust/src/css/typed_om.rs
@@ -232,7 +232,7 @@ pub fn in_canonical_unit(value: f64, unit: &str) -> (f64, String) {
if code == canonical_unit {
return (value, unit.to_owned());
}
- (value * ratio, dimension.unit_name(canonical_unit).to_owned())
+ (value * ratio, dimension.unit_name(canonical_unit).to_ascii_lowercase())
}
/// The ratio that converts a value in the unit `from` to the unit `to`, if they are compatible.
diff --git a/Tests/LibWeb/Text/expected/css/typed-om-frequency-sum-value.txt b/Tests/LibWeb/Text/expected/css/typed-om-frequency-sum-value.txt
index 88134370968..b0309f76f0a 100644
--- a/Tests/LibWeb/Text/expected/css/typed-om-frequency-sum-value.txt
+++ b/Tests/LibWeb/Text/expected/css/typed-om-frequency-sum-value.txt
@@ -2,7 +2,7 @@ hz
khz
calc(1hz + 1khz)
1000hz
-TypeError
-TypeError
+1001hz
+1.001khz
2000hz
false