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

[BlinkGenPropertyTrees] Set has_potential_animation of property nodes

This prevents unnecessary raster scale change during a composited
transform animation.

Bug: 933903
Change-Id: I2901f80d97b1f15807e19c3797a9817af1033621
Reviewed-on: https://chromium-review.googlesource.com/c/1482330
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635808}
parent d988c463
......@@ -274,6 +274,11 @@ int PropertyTreeManager::EnsureCompositorTransformNode(
compositor_node.element_id = compositor_element_id;
}
// Set has_potential_animation in case we push property tree during an ongoing
// animation. This condition should be kept consistent with cc.
if (transform_node.HasActiveTransformAnimation())
compositor_node.has_potential_animation = true;
// If this transform is a scroll offset translation, create the associated
// compositor scroll property node and adjust the compositor transform node's
// scroll offset.
......@@ -762,6 +767,14 @@ void PropertyTreeManager::BuildEffectNodesRecursively(
property_trees_.element_id_to_effect_node_index[compositor_element_id] =
effect_node.id;
}
// Set has_potential_xxx_animation in case we push property tree during
// ongoing animations. The conditions should be kept consistent with cc.
if (next_effect.HasActiveOpacityAnimation())
effect_node.has_potential_opacity_animation = true;
if (next_effect.HasActiveFilterAnimation())
effect_node.has_potential_filter_animation = true;
effect_stack_.emplace_back(current_);
SetCurrentEffectState(effect_node, CcEffectType::kEffect, next_effect,
*output_clip);
......
......@@ -152,15 +152,20 @@ class PLATFORM_EXPORT EffectPaintPropertyNode
FloatRect MapRect(const FloatRect& input_rect) const;
bool HasDirectCompositingReasons() const {
DCHECK(!Parent() || !IsParentAlias());
return state_.direct_compositing_reasons != CompositingReason::kNone;
return DirectCompositingReasons() != CompositingReason::kNone;
}
bool RequiresCompositingForAnimation() const {
DCHECK(!Parent() || !IsParentAlias());
return state_.direct_compositing_reasons &
return DirectCompositingReasons() &
CompositingReason::kComboActiveAnimation;
}
bool HasActiveOpacityAnimation() const {
return DirectCompositingReasons() &
CompositingReason::kActiveOpacityAnimation;
}
bool HasActiveFilterAnimation() const {
return DirectCompositingReasons() &
CompositingReason::kActiveFilterAnimation;
}
const CompositorElementId& GetCompositorElementId() const {
DCHECK(!Parent() || !IsParentAlias());
......@@ -178,6 +183,11 @@ class PLATFORM_EXPORT EffectPaintPropertyNode
bool is_parent_alias)
: PaintPropertyNode(parent, is_parent_alias), state_(std::move(state)) {}
CompositingReasons DirectCompositingReasons() const {
DCHECK(!Parent() || !IsParentAlias());
return state_.direct_compositing_reasons;
}
State state_;
};
......
......@@ -168,13 +168,16 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
}
bool HasDirectCompositingReasons() const {
return state_.direct_compositing_reasons != CompositingReason::kNone;
return DirectCompositingReasons() != CompositingReason::kNone;
}
bool RequiresCompositingForAnimation() const {
return state_.direct_compositing_reasons &
return DirectCompositingReasons() &
CompositingReason::kComboActiveAnimation;
}
bool HasActiveTransformAnimation() const {
return DirectCompositingReasons() &
CompositingReason::kActiveTransformAnimation;
}
bool RequiresCompositingForRootScroller() const {
return state_.direct_compositing_reasons & CompositingReason::kRootScroller;
......@@ -205,6 +208,11 @@ class PLATFORM_EXPORT TransformPaintPropertyNode
Validate();
}
CompositingReasons DirectCompositingReasons() const {
DCHECK(!Parent() || !IsParentAlias());
return state_.direct_compositing_reasons;
}
void CheckAndUpdateIsIdentityOr2DTranslation() {
if (IsParentAlias()) {
DCHECK(state_.matrix.IsIdentity());
......
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