Better computation of animation keyframes

This begins to address #26625 by properly applying CSS variables during
keyframe computation and no longer using `apply_declarations`. Instead,
walk the declarations, combining them into IntermediateComputedKeyframe,
maintaining declarations that modify CSS custom properties. Then compute
a set of AnimationValues for each keyframe and use those to produce
interpolated animation values.
This commit is contained in:
Martin Robinson 2020-05-26 19:42:28 +02:00
parent 83fa1b9eaa
commit b875f14e86
69 changed files with 269 additions and 1609 deletions

View file

@ -20,6 +20,8 @@ use crate::properties::ComputedValues;
use crate::rule_tree::{CascadeLevel, StrongRuleNode};
use crate::selector_parser::{PseudoElement, RestyleDamage};
use crate::style_resolver::ResolvedElementStyles;
use crate::style_resolver::{PseudoElementResolution, StyleResolverForElement};
use crate::stylist::RuleInclusion;
use crate::traversal_flags::TraversalFlags;
use selectors::matching::ElementSelectorFlags;
use servo_arc::{Arc, ArcBorrow};
@ -199,8 +201,6 @@ trait PrivateMatchMethods: TElement {
primary_style: &Arc<ComputedValues>,
) -> Option<Arc<ComputedValues>> {
use crate::context::CascadeInputs;
use crate::style_resolver::{PseudoElementResolution, StyleResolverForElement};
use crate::stylist::RuleInclusion;
let rule_node = primary_style.rules();
let without_transition_rules = context
@ -455,11 +455,18 @@ trait PrivateMatchMethods: TElement {
// for all the keyframes. We only want to do this if we think that there's a
// chance that the animations really changed.
if needs_animations_update {
let mut resolver = StyleResolverForElement::new(
*self,
context,
RuleInclusion::All,
PseudoElementResolution::IfApplicable,
);
animation_set.update_animations_for_new_style::<Self>(
*self,
&shared_context,
&new_values,
&context.thread_local.font_metrics_provider,
&mut resolver,
);
}