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

Side by Side Diff: cc/input/scrollbar_animation_controller.cc

Issue 2753933005: cc: Move Layer Id to Node Map to Individual Property Tree Private (Closed)
Patch Set: renaming to owning layer id 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/input/scrollbar_animation_controller.h" 5 #include "cc/input/scrollbar_animation_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) { 341 void ScrollbarAnimationController::ApplyOpacityToScrollbars(float opacity) {
342 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) { 342 for (ScrollbarLayerImplBase* scrollbar : Scrollbars()) {
343 if (!scrollbar->is_overlay_scrollbar()) 343 if (!scrollbar->is_overlay_scrollbar())
344 continue; 344 continue;
345 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0; 345 float effective_opacity = scrollbar->CanScrollOrientation() ? opacity : 0;
346 PropertyTrees* property_trees = 346 PropertyTrees* property_trees =
347 scrollbar->layer_tree_impl()->property_trees(); 347 scrollbar->layer_tree_impl()->property_trees();
348 // If this method is called during LayerImpl::PushPropertiesTo, we may not 348 // If this method is called during LayerImpl::PushPropertiesTo, we may not
349 // yet have valid layer_id_to_effect_node_index entries as property trees 349 // yet have valid layer_id_to_node_index entries in effect tree as property
pdr. 2017/03/16 22:17:41 Nit layer_id_to_node_index -> owning_layer_id_to_n
350 // are pushed after layers during activation. We can skip updating opacity 350 // trees are pushed after layers during activation. We can skip updating
351 // in that case as we are only registering a scrollbar and because opacity 351 // opacity in that case as we are only registering a scrollbar and because
352 // will be overwritten anyway when property trees are pushed. 352 // opacity will be overwritten anyway when property trees are pushed.
353 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, 353 if (property_trees->effect_tree.FindNodeIndexFromOwningLayerId(
354 scrollbar->id())) { 354 scrollbar->id()) != EffectTree::kInvalidNodeId) {
355 property_trees->effect_tree.OnOpacityAnimated( 355 property_trees->effect_tree.OnOpacityAnimated(
356 effective_opacity, 356 effective_opacity,
357 property_trees->layer_id_to_effect_node_index[scrollbar->id()], 357 property_trees->effect_tree.FindNodeIndexFromOwningLayerId(
358 scrollbar->id()),
358 scrollbar->layer_tree_impl()); 359 scrollbar->layer_tree_impl());
359 } 360 }
360 } 361 }
361 362
362 bool previouslyVisible = opacity_ > 0.0f; 363 bool previouslyVisible = opacity_ > 0.0f;
363 bool currentlyVisible = opacity > 0.0f; 364 bool currentlyVisible = opacity > 0.0f;
364 365
365 opacity_ = opacity; 366 opacity_ = opacity;
366 367
367 if (previouslyVisible != currentlyVisible) 368 if (previouslyVisible != currentlyVisible)
368 client_->DidChangeScrollbarVisibility(); 369 client_->DidChangeScrollbarVisibility();
369 } 370 }
370 371
371 } // namespace cc 372 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698