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

Unified Diff: cc/layers/scrollbar_layer_impl_base.cc

Issue 2762123004: cc: LayerTreeHostImpl uses element id to tick animations (Closed)
Patch Set: review comments Created 3 years, 9 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
Index: cc/layers/scrollbar_layer_impl_base.cc
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc
index 61924f3d1291ad62a6bd900a9dff9cbb390343ed..da53036fea0a07cd555c932d769ce32092f6aa19 100644
--- a/cc/layers/scrollbar_layer_impl_base.cc
+++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -5,6 +5,7 @@
#include "cc/layers/scrollbar_layer_impl_base.h"
#include <algorithm>
+#include "cc/trees/effect_node.h"
#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -200,4 +201,35 @@ gfx::Rect ScrollbarLayerImplBase::ComputeThumbQuadRect() const {
return gfx::ToEnclosingRect(thumb_rect);
}
+void ScrollbarLayerImplBase::SetOverlayScrollbarLayerOpacityAnimated(
+ float opacity) {
+ DCHECK(is_overlay_scrollbar());
+ if (!layer_tree_impl())
+ return;
+
+ PropertyTrees* property_trees = layer_tree_impl()->property_trees();
+ int effect_node_index =
+ property_trees->effect_tree.FindNodeIndexFromOwningLayerId(id());
+ // If this method is called during LayerImpl::PushPropertiesTo, we may not yet
+ // have valid owning_layer_id_to_node_index entries in effect tree 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 (effect_node_index == EffectTree::kInvalidNodeId ||
+ effect_node_index != effect_tree_index())
+ return;
+
+ EffectNode* node = property_trees->effect_tree.Node(effect_tree_index());
+ if (node->opacity == opacity)
+ return;
+
+ layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
+
+ node->opacity = opacity;
+ node->effect_changed = true;
+ property_trees->changed = true;
+ property_trees->effect_tree.set_needs_update(true);
+ layer_tree_impl()->set_needs_update_draw_properties();
+}
+
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698