commit 012eab4db03567403be0f9a5ebb98c1e1b2c060f
parent 400385b6021bbd1c4b5d40147cc11c7db08b07cc
Author: Oriol Brufau <obrufau@igalia.com>
Date: Mon, 20 Oct 2025 13:13:46 +0000
Bug 1995276 - Remove `is_definitely_zero()`. r=firefox-style-system-reviewers,dshin
It's no longer needed.
Differential Revision: https://phabricator.services.mozilla.com/D269203
Diffstat:
3 files changed, 7 insertions(+), 40 deletions(-)
diff --git a/servo/components/style/values/computed/length.rs b/servo/components/style/values/computed/length.rs
@@ -103,16 +103,6 @@ macro_rules! computed_length_percentage_or_auto {
Self::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)),
}
}
-
- /// Returns true if the computed value is absolute 0 or 0%.
- #[inline]
- pub fn is_definitely_zero(&self) -> bool {
- use crate::values::generics::length::LengthPercentageOrAuto::*;
- match *self {
- LengthPercentage(ref l) => l.is_definitely_zero(),
- Auto => false,
- }
- }
};
}
diff --git a/servo/components/style/values/computed/length_percentage.rs b/servo/components/style/values/computed/length_percentage.rs
@@ -449,16 +449,6 @@ impl LengthPercentage {
}
}
- /// Returns true if the computed value is absolute 0 or 0%.
- #[inline]
- pub fn is_definitely_zero(&self) -> bool {
- match self.unpack() {
- Unpacked::Length(l) => l.px() == 0.0,
- Unpacked::Percentage(p) => p.0 == 0.0,
- Unpacked::Calc(..) => false,
- }
- }
-
/// Resolves the percentage.
#[inline]
pub fn resolve(&self, basis: Length) -> Length {
@@ -657,16 +647,21 @@ impl Zero for LengthPercentage {
LengthPercentage::new_length(Length::zero())
}
+ /// Returns true if the computed value is absolute 0 or 0%.
#[inline]
fn is_zero(&self) -> bool {
- self.is_definitely_zero()
+ match self.unpack() {
+ Unpacked::Length(l) => l.px() == 0.0,
+ Unpacked::Percentage(p) => p.0 == 0.0,
+ Unpacked::Calc(..) => false,
+ }
}
}
impl ZeroNoPercent for LengthPercentage {
#[inline]
fn is_zero_no_percent(&self) -> bool {
- self.is_definitely_zero() && !self.has_percentage()
+ self.to_length().is_some_and(|l| l.px() == 0.0)
}
}
@@ -1322,12 +1317,6 @@ impl ToAnimatedValue for NonNegativeLengthPercentage {
}
impl NonNegativeLengthPercentage {
- /// Returns true if the computed value is absolute 0 or 0%.
- #[inline]
- pub fn is_definitely_zero(&self) -> bool {
- self.0.is_definitely_zero()
- }
-
/// Returns the used value.
#[inline]
pub fn to_used_value(&self, containing_length: Au) -> Au {
diff --git a/servo/components/style/values/generics/length.rs b/servo/components/style/values/generics/length.rs
@@ -595,18 +595,6 @@ impl<LP> GenericMargin<LP> {
}
}
-#[cfg(feature = "servo")]
-impl GenericMargin<crate::values::computed::LengthPercentage> {
- /// Returns true if the computed value is absolute 0 or 0%.
- #[inline]
- pub fn is_definitely_zero(&self) -> bool {
- match self {
- Self::LengthPercentage(lp) => lp.is_definitely_zero(),
- _ => false,
- }
- }
-}
-
impl<LP> SpecifiedValueInfo for GenericMargin<LP>
where
LP: SpecifiedValueInfo,