diff --git a/style/values/computed/length_percentage.rs b/style/values/computed/length_percentage.rs index ade53ce5e..0a2a50289 100644 --- a/style/values/computed/length_percentage.rs +++ b/style/values/computed/length_percentage.rs @@ -509,7 +509,7 @@ impl LengthPercentage { /// Returns the used value. #[inline] pub fn to_used_value(&self, containing_length: Au) -> Au { - Au::from(self.to_pixel_length(containing_length)) + Au::from_f32_px(self.to_pixel_length(containing_length).px().floor()) } /// Returns the used value as CSSPixelLength. @@ -522,7 +522,7 @@ impl LengthPercentage { #[inline] pub fn maybe_to_used_value(&self, container_len: Option) -> Option { self.maybe_percentage_relative_to(container_len.map(Length::from)) - .map(Au::from) + .map(|p| Au::from_f32_px(p.px().floor())) } /// If there are special rules for computing percentages in a value (e.g.