Commit 8b0c02e2 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[scroll-animations] Don't compute timeline for animation style changes

Currently we are creating a new ScrollTimeline for every frame, even
for is_animation_style_change==true, in which case we don't even
look at the 'timeline' variable.

This CL moves the timeline computation to the branch handling
new animations, such that we don't waste time by creating timelines
that are never used.

Bug: 1074052
Change-Id: If9327fa9dbc97666aae3377cc8b22deb95382932
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2374448
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801478}
parent d3a5e4ea
......@@ -618,9 +618,6 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
StyleRuleScrollTimeline* scroll_timeline_rule =
FindScrollTimelineRule(element.GetDocument(), timeline_name);
AnimationTimeline* timeline =
ComputeTimeline(&element, timeline_name, scroll_timeline_rule);
const RunningAnimation* existing_animation = nullptr;
wtf_size_t existing_animation_index = 0;
......@@ -682,6 +679,8 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
}
} else {
DCHECK(!is_animation_style_change);
AnimationTimeline* timeline =
ComputeTimeline(&element, timeline_name, scroll_timeline_rule);
base::Optional<TimelinePhase> inherited_phase;
base::Optional<double> inherited_time;
if (timeline) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment