style: Forbid negative CSS resolutions at parse time

Apply some clang-tidy suggestions while I was going through the
ServoStyleConstsInlines while at it.

Remove one 0x test because it's tested on the same test and causes a
harness error.

Differential Revision: https://phabricator.services.mozilla.com/D180331
This commit is contained in:
Emilio Cobos Álvarez 2023-06-08 16:57:31 +00:00 committed by Martin Robinson
parent 019c14cf0b
commit dcb61c095f
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ impl ToComputedValue for specified::Resolution {
#[inline]
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
Resolution(self.dppx())
Resolution(crate::values::normalize(self.dppx().max(0.0)))
}
#[inline]

View file

@ -129,7 +129,7 @@ impl Parse for Resolution {
match *input.next()? {
Token::Dimension {
value, ref unit, ..
} => Self::parse_dimension(value, unit)
} if value >= 0. => Self::parse_dimension(value, unit)
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
Token::Function(ref name) => {
let function = CalcNode::math_function(context, name, location)?;