style: 0% values are not skipped when parsing CSS transform

Adds trait ZeroNoPercent to check for values that are 0 (such as 0px) but not 0%

Updated test css/css-transforms/animation/translate-interpolation.html and removed unnecessary formatting changes

Differential Revision: https://phabricator.services.mozilla.com/D154930
This commit is contained in:
AW255 2022-08-26 11:11:30 +00:00 committed by Martin Robinson
parent aefbae5f96
commit 12a2c88605
4 changed files with 33 additions and 11 deletions

View file

@ -30,7 +30,7 @@ use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
use crate::values::generics::{calc, NonNegative};
use crate::values::specified::length::FontBaseSize;
use crate::values::{specified, CSSFloat};
use crate::Zero;
use crate::{Zero, ZeroNoPercent};
use app_units::Au;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use serde::{Deserialize, Serialize};
@ -556,6 +556,13 @@ impl Zero for LengthPercentage {
}
}
impl ZeroNoPercent for LengthPercentage {
#[inline]
fn is_zero_no_percent(&self) -> bool {
self.is_definitely_zero() && !self.has_percentage()
}
}
impl Serialize for LengthPercentage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where