Skip to content

Truly independent web browser

LibWeb: Accept a missing second operand in numeric type operations

Andreas Klingeb5262a610d8
diff --git a/Libraries/LibWeb/Rust/src/css/calc.rs b/Libraries/LibWeb/Rust/src/css/calc.rs
index 5f7f4bdd274..b87984c8369 100644
--- a/Libraries/LibWeb/Rust/src/css/calc.rs
+++ b/Libraries/LibWeb/Rust/src/css/calc.rs
@@ -526,12 +526,13 @@ pub enum FfiNumericTypeMatch {
pub extern "C" fn rust_numeric_type_operate(
operation: FfiNumericTypeOperation,
first: &FfiNumericType,
- second: &FfiNumericType,
+ second: Option<&FfiNumericType>,
) -> FfiNumericType {
let first = first.to_calc();
+ let second = || second.expect("the operation has a second operand").to_calc();
let result = match operation {
- FfiNumericTypeOperation::Add => first.added_to(&second.to_calc()),
- FfiNumericTypeOperation::Multiply => first.multiplied_by(&second.to_calc()),
+ FfiNumericTypeOperation::Add => first.added_to(&second()),
+ FfiNumericTypeOperation::Multiply => first.multiplied_by(&second()),
FfiNumericTypeOperation::Invert => Some(first.inverted()),
};
FfiNumericType::from_calc(result)