Skip to content

Commit ebd1832

Browse files
committed
1 parent 8d05108 commit ebd1832

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

style/properties/properties.mako.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,7 +2176,7 @@ impl ComputedValuesInner {
21762176

21772177
/// Gets the logical computed margin from this style.
21782178
#[inline]
2179-
pub fn logical_margin(&self) -> LogicalMargin<<&computed::LengthPercentageOrAuto> {
2179+
pub fn logical_margin(&self) -> LogicalMargin<<&computed::Margin> {
21802180
let margin_style = self.get_margin();
21812181
LogicalMargin::from_physical(self.writing_mode, SideOffsets2D::new(
21822182
&margin_style.margin_top,

style/values/generics/length.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,27 @@ pub enum GenericMargin<LP> {
532532
),
533533
}
534534

535+
#[cfg(feature = "servo")]
536+
impl<LP> GenericMargin<LP> {
537+
/// Return true if it is 'auto'.
538+
#[inline]
539+
pub fn is_auto(&self) -> bool {
540+
matches!(self, Self::Auto)
541+
}
542+
}
543+
544+
#[cfg(feature = "servo")]
545+
impl GenericMargin<crate::values::computed::LengthPercentage> {
546+
/// Returns true if the computed value is absolute 0 or 0%.
547+
#[inline]
548+
pub fn is_definitely_zero(&self) -> bool {
549+
match self {
550+
Self::LengthPercentage(lp) => lp.is_definitely_zero(),
551+
_ => false,
552+
}
553+
}
554+
}
555+
535556
impl<LP> SpecifiedValueInfo for GenericMargin<LP>
536557
where
537558
LP: SpecifiedValueInfo,

0 commit comments

Comments
 (0)