style: Part 1: Add animation-timeline longhand property in style system

This patch adds the animation-timeline longhand property. For
shorthand, we will do that in the next patch.

This patch includes the aut-generated code in
devtools/shared/css/generated/properties-db.js, by `./mach devtools-css-db`.

Note:
1. we will use this property in Bug 1676791. For now, only make sure
   we parse it and serialize it correctly.
2. The syntax of animation-timeline may be updated, based on the spec
   issue: https://github.com/w3c/csswg-drafts/issues/6674.
   However, it's not a big problem to update it later, so we still can
   prototype this property based on the current version of spec.

Differential Revision: https://phabricator.services.mozilla.com/D126450
This commit is contained in:
Boris Chiou 2023-05-27 15:04:42 +02:00 committed by Oriol Brufau
parent 7d8a87cd01
commit 2a7436481c
9 changed files with 108 additions and 14 deletions

View file

@ -1049,7 +1049,7 @@ fn static_assert() {
% if member:
ours.m${gecko_ffi_name}.${member} = others.m${gecko_ffi_name}.${member};
% else:
ours.m${gecko_ffi_name} = others.m${gecko_ffi_name};
ours.m${gecko_ffi_name} = others.m${gecko_ffi_name}.clone();
% endif
}
}
@ -1183,7 +1183,7 @@ fn static_assert() {
<% skip_box_longhands= """display
animation-name animation-delay animation-duration
animation-direction animation-fill-mode animation-play-state
animation-iteration-count animation-timing-function
animation-iteration-count animation-timeline animation-timing-function
clear transition-duration transition-delay
transition-timing-function transition-property
-webkit-line-clamp""" %>
@ -1445,6 +1445,27 @@ fn static_assert() {
${impl_copy_animation_value('iteration_count', 'IterationCount')}
${impl_animation_or_transition_timing_function('animation')}
pub fn set_animation_timeline<I>(&mut self, v: I)
where
I: IntoIterator<Item = longhands::animation_timeline::computed_value::single_value::T>,
I::IntoIter: ExactSizeIterator
{
let v = v.into_iter();
debug_assert_ne!(v.len(), 0);
let input_len = v.len();
self.gecko.mAnimations.ensure_len(input_len);
self.gecko.mAnimationTimelineCount = input_len as u32;
for (gecko, servo) in self.gecko.mAnimations.iter_mut().take(input_len as usize).zip(v) {
gecko.mTimeline = servo;
}
}
pub fn animation_timeline_at(&self, index: usize) -> values::specified::box_::AnimationTimeline {
self.gecko.mAnimations[index].mTimeline.clone()
}
${impl_animation_count('timeline', 'Timeline')}
${impl_copy_animation_value('timeline', 'Timeline')}
#[allow(non_snake_case)]
pub fn set__webkit_line_clamp(&mut self, v: longhands::_webkit_line_clamp::computed_value::T) {
self.gecko.mLineClamp = match v {