mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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:
parent
019c14cf0b
commit
dcb61c095f
2 changed files with 2 additions and 2 deletions
|
@ -36,7 +36,7 @@ impl ToComputedValue for specified::Resolution {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
|
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue {
|
||||||
Resolution(self.dppx())
|
Resolution(crate::values::normalize(self.dppx().max(0.0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl Parse for Resolution {
|
||||||
match *input.next()? {
|
match *input.next()? {
|
||||||
Token::Dimension {
|
Token::Dimension {
|
||||||
value, ref unit, ..
|
value, ref unit, ..
|
||||||
} => Self::parse_dimension(value, unit)
|
} if value >= 0. => Self::parse_dimension(value, unit)
|
||||||
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
.map_err(|()| location.new_custom_error(StyleParseErrorKind::UnspecifiedError)),
|
||||||
Token::Function(ref name) => {
|
Token::Function(ref name) => {
|
||||||
let function = CalcNode::math_function(context, name, location)?;
|
let function = CalcNode::math_function(context, name, location)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue