diff --git a/components/style/macros.rs b/components/style/macros.rs index 503c13ba283..bdbaaab5dbe 100644 --- a/components/style/macros.rs +++ b/components/style/macros.rs @@ -4,6 +4,24 @@ //! Various macro helpers. +macro_rules! trivial_to_computed_value { + ($name: ident) => { + impl $crate::values::computed::ToComputedValue for $name { + type ComputedValue = $name; + + fn to_computed_value(&self, _: &$crate::values::computed::Context) -> Self { + self.clone() + } + + fn from_computed_value(other: &Self) -> Self { + other.clone() + } + } + } +} + +trivial_to_computed_value!(i32); + /// A macro to parse an identifier, or return an `UnexpectedIndent` error /// otherwise. /// @@ -76,17 +94,7 @@ macro_rules! add_impls_for_keyword_enum { } } - impl $crate::values::computed::ToComputedValue for $name { - type ComputedValue = $name; - - fn to_computed_value(&self, _: &$crate::values::computed::Context) -> Self { - self.clone() - } - - fn from_computed_value(other: &Self) -> Self { - other.clone() - } - } + trivial_to_computed_value!($name); }; } diff --git a/components/style/properties/longhand/table.mako.rs b/components/style/properties/longhand/table.mako.rs index 68f40e22d37..5cc753b38ab 100644 --- a/components/style/properties/longhand/table.mako.rs +++ b/components/style/properties/longhand/table.mako.rs @@ -14,15 +14,12 @@ ${helpers.single_keyword("table-layout", "auto fixed", spec="Internal-only (for `