From 54965bbcb9b6261d74c6ff587dffa3d748c1ac56 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 17 May 2023 00:32:26 +0200 Subject: [PATCH] style: Fix whitespace handling in clamp() parsing We should just restore the state when seeing whitespace and an unknown token like when we do when finding any other token a few lines below. This is not an issue for most callers (it's only an issue for clamp()) because the other callers use either `parse_comma_separated()` (for min/max), or `parse_nested_block()` (for parens / nested calc()). Both of those functions restrict the input in such a way that is_exhausted returns true (a few lines above) and thus we parse successfully. Differential Revision: https://phabricator.services.mozilla.com/D112681 --- components/style/values/specified/calc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index c42683bce1f..d5733a6ce4a 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -374,9 +374,9 @@ impl CalcNode { rhs.negate(); sum.push(rhs); }, - ref t => { - let t = t.clone(); - return Err(input.new_unexpected_token_error(t)); + _ => { + input.reset(&start); + break; }, } },