diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index 46d27aa3691..e49c39bc7b8 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -252,7 +252,6 @@ -> Result<(GridTemplateComponent, GridTemplateComponent, Either), ParseError<'i>> { - // Other shorthand sub properties also parse `none` and `subgrid` keywords and this // shorthand should know after these keywords there is nothing to parse. Otherwise it // gets confused and rejects the sub properties that contains `none` or `subgrid`. diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index 5c98d5c33dc..b50fb2cf403 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -354,8 +354,13 @@ pub enum RepeatCount { impl Parse for RepeatCount { fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { - if let Ok(i) = input.try(|i| Integer::parse(context, i)) { + // Maximum number of repeat is 10000. The greater numbers should be clamped. + const MAX_LINE: i32 = 10000; + if let Ok(mut i) = input.try(|i| Integer::parse(context, i)) { if i.value() > 0 { + if i.value() > MAX_LINE { + i = Integer::new(MAX_LINE); + } Ok(RepeatCount::Number(i)) } else { Err(StyleParseError::UnspecifiedError.into())