diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index e2c723f5e65..d82dfe727a9 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -678,6 +678,11 @@ extern "C" { *mut ::std::os::raw::c_void, len: usize); } +extern "C" { + pub fn Gecko_EnsureStyleTransitionArrayLength(array: + *mut ::std::os::raw::c_void, + len: usize); +} extern "C" { pub fn Gecko_AnimationAppendKeyframe(keyframes: RawGeckoKeyframeListBorrowedMut, 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 b20ee735631..be1a20c570f 100644 --- a/components/style/gecko_bindings/sugar/ns_style_auto_array.rs +++ b/components/style/gecko_bindings/sugar/ns_style_auto_array.rs @@ -5,6 +5,8 @@ //! Rust helpers for Gecko's `nsStyleAutoArray`. use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength; +use gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength; +use gecko_bindings::structs::{StyleAnimation, StyleTransition}; use gecko_bindings::structs::nsStyleAutoArray; use std::iter::{once, Chain, Once, IntoIterator}; use std::ops::{Index, IndexMut}; @@ -53,12 +55,22 @@ impl nsStyleAutoArray { pub fn len(&self) -> usize { 1 + self.mOtherElements.len() } +} +impl nsStyleAutoArray { /// 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); + Gecko_EnsureStyleAnimationArrayLength(self as *mut nsStyleAutoArray as *mut _, len); + } + } +} + +impl nsStyleAutoArray { + /// Ensures that the array has length at least the given length. + pub fn ensure_len(&mut self, len: usize) { + unsafe { + Gecko_EnsureStyleTransitionArrayLength(self as *mut nsStyleAutoArray as *mut _, len); } } }