Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1647)

Unified Diff: cc/input/scrollbar_animation_controller_linear_fade.cc

Issue 2273933002: cc : Delete LayerImpl::OnOpacityAnimated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller_linear_fade_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/scrollbar_animation_controller_linear_fade.cc
diff --git a/cc/input/scrollbar_animation_controller_linear_fade.cc b/cc/input/scrollbar_animation_controller_linear_fade.cc
index 8ead32491a3f9eebd4ccc55b1bdb3f77ab04cf89..8695bfaf6cf57b4199e3faec1a4ae539f50a0795 100644
--- a/cc/input/scrollbar_animation_controller_linear_fade.cc
+++ b/cc/input/scrollbar_animation_controller_linear_fade.cc
@@ -8,6 +8,7 @@
#include "base/time/time.h"
#include "cc/layers/layer_impl.h"
#include "cc/layers/scrollbar_layer_impl_base.h"
+#include "cc/trees/layer_tree_impl.h"
namespace cc {
@@ -55,8 +56,20 @@ void ScrollbarAnimationControllerLinearFade::ApplyOpacityToScrollbars(
for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
if (!scrollbar->is_overlay_scrollbar())
continue;
- scrollbar->OnOpacityAnimated(scrollbar->CanScrollOrientation() ? opacity
- : 0);
+ PropertyTrees* property_trees =
+ scrollbar->layer_tree_impl()->property_trees();
+ // If this method is called during LayerImpl::PushPropertiesTo, we may not
+ // yet have valid effect_id_to_index_map entries as property trees are
+ // pushed after layers during activation. We can skip updating opacity in
+ // that case as we are only registering a scrollbar and because opacity will
+ // be overwritten anyway when property trees are pushed.
+ if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT,
+ scrollbar->id())) {
+ property_trees->effect_tree.OnOpacityAnimated(
+ scrollbar->CanScrollOrientation() ? opacity : 0,
+ property_trees->effect_id_to_index_map[scrollbar->id()],
+ scrollbar->layer_tree_impl());
+ }
}
}
« no previous file with comments | « no previous file | cc/input/scrollbar_animation_controller_linear_fade_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698