diff --git a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs index 4ef12625d2d..9c41a0b6ec4 100644 --- a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs +++ b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs @@ -4,6 +4,7 @@ //! Rust helpers for Gecko's `nsStyleAutoArray`. +use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength; use gecko_bindings::structs::nsStyleAutoArray; use std::iter::{once, Chain, Once, IntoIterator}; use std::ops::Index; @@ -40,6 +41,14 @@ impl nsStyleAutoArray { pub fn len(&self) -> usize { 1 + self.mOtherElements.len() } + + /// Ensures that the array has length at least the given length. + pub fn ensure_len(&mut self, len: usize) { + unsafe { + Gecko_EnsureStyleAnimationArrayLength(self as *mut nsStyleAutoArray as *mut _, + len); + } + } } impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray {