Skip to content

Commit

Permalink
style: Implement CSS animation-composition longhand in style system
Browse files Browse the repository at this point in the history
This patch introduces animation-composition longhand but we don't
accept it in @Keyframe rule for now. I will support this for @Keyframe
in the patch series.

Besides, the shorthand of animation doesn't include animation-composition.
The spec issue is: w3c/csswg-drafts#6946.
We could fix the shorthand once this spec issue gets updated.

Differential Revision: https://phabricator.services.mozilla.com/D150299
  • Loading branch information
BorisChiou authored and Loirooriol committed Sep 25, 2023
1 parent 40a34ae commit 208dc23
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/style/properties/gecko.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask-
<% skip_ui_longhands = """animation-name animation-delay animation-duration
animation-direction animation-fill-mode
animation-play-state animation-iteration-count
animation-timeline animation-timing-function
animation-timing-function animation-composition animation-timeline
transition-duration transition-delay
transition-timing-function transition-property""" %>

Expand Down Expand Up @@ -1863,6 +1863,8 @@ mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask-
&& self.gecko.mAnimationIterationCountCount == other.gecko.mAnimationIterationCountCount
&& self.gecko.mAnimationPlayStateCount == other.gecko.mAnimationPlayStateCount
&& self.gecko.mAnimationTimingFunctionCount == other.gecko.mAnimationTimingFunctionCount
&& self.gecko.mAnimationCompositionCount == other.gecko.mAnimationCompositionCount
&& self.gecko.mAnimationTimelineCount == other.gecko.mAnimationTimelineCount
&& unsafe { bindings::Gecko_StyleAnimationsEquals(&self.gecko.mAnimations, &other.gecko.mAnimations) }
}

Expand Down Expand Up @@ -1907,6 +1909,8 @@ mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask-
data.longhands_by_name["animation-fill-mode"].keyword)}
${impl_animation_keyword('play_state', 'PlayState',
data.longhands_by_name["animation-play-state"].keyword)}
${impl_animation_keyword('composition', 'Composition',
data.longhands_by_name["animation-composition"].keyword)}

pub fn set_animation_iteration_count<I>(&mut self, v: I)
where
Expand Down
14 changes: 14 additions & 0 deletions components/style/properties/longhands/ui.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,20 @@ ${helpers.single_keyword(
rule_types_allowed=DEFAULT_RULES_EXCEPT_KEYFRAME,
)}

${helpers.single_keyword(
"animation-composition",
"replace add accumulate",
engines="gecko",
need_index=True,
animation_value_type="none",
vector=True,
gecko_enum_prefix="CompositeOperation",
gecko_inexhaustive=True,
gecko_pref="layout.css.animation-composition.enabled",
spec="https://drafts.csswg.org/css-animations-2/#animation-composition",
rule_types_allowed=DEFAULT_RULES_EXCEPT_KEYFRAME,
)}

${helpers.predefined_type(
"animation-delay",
"Time",
Expand Down

0 comments on commit 208dc23

Please sign in to comment.