mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
ensure_len() for nsStyleAutoArray<StyleTransition>.
This commit is contained in:
parent
e5386ed7aa
commit
96dbc9849d
2 changed files with 19 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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<T> nsStyleAutoArray<T> {
|
|||
pub fn len(&self) -> usize {
|
||||
1 + self.mOtherElements.len()
|
||||
}
|
||||
}
|
||||
|
||||
impl nsStyleAutoArray<StyleAnimation> {
|
||||
/// 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<T> as *mut _,
|
||||
len);
|
||||
Gecko_EnsureStyleAnimationArrayLength(self as *mut nsStyleAutoArray<StyleAnimation> as *mut _, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl nsStyleAutoArray<StyleTransition> {
|
||||
/// 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<StyleTransition> as *mut _, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue