Commit cfe03a4d authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

[BGPT] Allow direct transform/opacity update on the end of animation

We chose to skip direct transform/opacity if the property is animating
in compositor in crrev.com/c/1565467 (fast-path for simple transform
change) to reduce risk of it.

We observed that it caused regressions for several benchmarks. Now
allow direct transform/opacity on the end of animation in this separate
CL.

We already have several test cases testing the situation.

Bug: 954611
Change-Id: I6a8516dba92f6a3b02efd664bbc12315fe94d63b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585263Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654497}
parent 22d09875
......@@ -85,9 +85,14 @@ bool PropertyTreeManager::DirectlyUpdateCompositedOpacityValue(
if (it == effect_node_map_.end())
return false;
auto* cc_effect = property_trees->effect_tree.Node(it->value);
if (!cc_effect || cc_effect->is_currently_animating_opacity)
if (!cc_effect)
return false;
// We directly update opacity only when it's not animating in compositor. If
// the compositor has not cleared is_currently_animating_opacity, we should
// clear it now to let the compositor respect the new value.
cc_effect->is_currently_animating_opacity = false;
cc_effect->opacity = effect.Opacity();
cc_effect->effect_changed = true;
property_trees->effect_tree.set_needs_update(true);
......@@ -112,9 +117,11 @@ bool PropertyTreeManager::DirectlyUpdateScrollOffsetTransform(
return false;
auto* cc_transform = property_trees->transform_tree.Node(transform_it->value);
if (!cc_scroll_node || !cc_transform || cc_transform->is_currently_animating)
if (!cc_scroll_node || !cc_transform)
return false;
DCHECK(!cc_transform->is_currently_animating);
UpdateCcTransformLocalMatrix(*cc_transform, transform);
SetCcTransformNodeScrollToTransformTranslation(*cc_transform, transform);
property_trees->scroll_tree.SetScrollOffset(
......@@ -137,11 +144,16 @@ bool PropertyTreeManager::DirectlyUpdateTransform(
if (transform_it == transform_node_map_.end())
return false;
auto* cc_transform = property_trees->transform_tree.Node(transform_it->value);
if (!cc_transform || cc_transform->is_currently_animating)
if (!cc_transform)
return false;
UpdateCcTransformLocalMatrix(*cc_transform, transform);
// We directly update transform only when the transform is not animating in
// compositor. If the compositor has not cleared the is_currently_animating
// flag, we should clear it to let the compositor respect the new value.
cc_transform->is_currently_animating = false;
cc_transform->transform_changed = true;
property_trees->transform_tree.set_needs_update(true);
return true;
......
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