aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/dom_wrapper.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2020-05-18 16:32:41 +0200
committerMartin Robinson <mrobinson@igalia.com>2020-06-05 13:21:19 +0200
commit83fa1b9eaabefaf5922521d639ef9a0b9bb989df (patch)
tree218f9df5f3bc67088d9e0375485bb69076358ee4 /components/layout_thread/dom_wrapper.rs
parent7df4655b604683aee5763696589b041024b264ce (diff)
downloadservo-83fa1b9eaabefaf5922521d639ef9a0b9bb989df.tar.gz
servo-83fa1b9eaabefaf5922521d639ef9a0b9bb989df.zip
Cache animation computed values when animations change
Instead of recalculating the animation style every tick of an animation, cache the computed values when animations change. In addition to being more efficient, this will allow us to return animation rules as property declarations because we don't need to consult the final style to produce them.
Diffstat (limited to 'components/layout_thread/dom_wrapper.rs')
-rw-r--r--components/layout_thread/dom_wrapper.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs
index 1ec4c92fcf0..5eb057cdc4f 100644
--- a/components/layout_thread/dom_wrapper.rs
+++ b/components/layout_thread/dom_wrapper.rs
@@ -584,8 +584,13 @@ impl<'le> TElement for ServoLayoutElement<'le> {
false
}
- fn has_css_animations(&self) -> bool {
- unreachable!("this should be only called on gecko");
+ fn has_css_animations(&self, context: &SharedStyleContext) -> bool {
+ context
+ .animation_states
+ .read()
+ .get(&self.as_node().opaque())
+ .map(|set| set.has_active_animation())
+ .unwrap_or(false)
}
fn has_css_transitions(&self) -> bool {