aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/properties/declaration_block.rs4
-rw-r--r--components/style/properties/properties.mako.rs7
2 files changed, 10 insertions, 1 deletions
diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs
index a6d736fb49f..dfe619fc79b 100644
--- a/components/style/properties/declaration_block.rs
+++ b/components/style/properties/declaration_block.rs
@@ -309,7 +309,9 @@ impl PropertyDeclarationBlock {
.find(|(declaration, _)| declaration.id() == property)
}
- fn shorthand_to_css(
+ /// Tries to serialize a given shorthand from the declarations in this
+ /// block.
+ pub fn shorthand_to_css(
&self,
shorthand: ShorthandId,
dest: &mut CssStringWriter,
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index 072b78cf377..ad51e87fb2f 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -1354,6 +1354,13 @@ impl ShorthandId {
NonCustomPropertyId::from(self).to_nscsspropertyid()
}
+ /// Converts from a nsCSSPropertyID to a ShorthandId.
+ #[cfg(feature = "gecko")]
+ #[inline]
+ pub fn from_nscsspropertyid(prop: nsCSSPropertyID) -> Result<Self, ()> {
+ PropertyId::from_nscsspropertyid(prop)?.as_shorthand().map_err(|_| ())
+ }
+
/// Get the longhand ids that form this shorthand.
pub fn longhands(&self) -> NonCustomPropertyIterator<LonghandId> {
% for property in data.shorthands: