style: Support view-timeline-name and view-timeline-axis in style system

view-timeline-name: `none | <custom-ident>#`
view-timeline-axis: `[ block | inline | vertical | horizontal ]#`

Note:
Both view-timeline-name and scroll-timeline-name should accept `auto`.
We will fix it in this patch series.

Differential Revision: https://phabricator.services.mozilla.com/D166242
This commit is contained in:
Boris Chiou 2023-01-24 22:21:19 +00:00 committed by Martin Robinson
parent 863716a0a1
commit b5b64af3f1
3 changed files with 55 additions and 12 deletions

View file

@ -6,8 +6,9 @@
use crate::gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
use crate::gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
use crate::gecko_bindings::bindings::Gecko_EnsureStyleViewTimelineArrayLength;
use crate::gecko_bindings::structs::nsStyleAutoArray;
use crate::gecko_bindings::structs::{StyleAnimation, StyleTransition};
use crate::gecko_bindings::structs::{StyleAnimation, StyleTransition, StyleViewTimeline};
use std::iter::{once, Chain, IntoIterator, Once};
use std::ops::{Index, IndexMut};
use std::slice::{Iter, IterMut};
@ -75,6 +76,18 @@ impl nsStyleAutoArray<StyleTransition> {
}
}
impl nsStyleAutoArray<StyleViewTimeline> {
/// Ensures that the array has length at least the given length.
pub fn ensure_len(&mut self, len: usize) {
unsafe {
Gecko_EnsureStyleViewTimelineArrayLength(
self as *mut nsStyleAutoArray<StyleViewTimeline> as *mut _,
len,
);
}
}
}
impl<'a, T> IntoIterator for &'a mut nsStyleAutoArray<T> {
type Item = &'a mut T;
type IntoIter = Chain<Once<&'a mut T>, IterMut<'a, T>>;