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

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 clean up 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 owning_layer_id_to_node_index entries in effect tree as
350 // are pushed after layers during activation. We can skip updating opacity 350 // property trees are pushed after layers during activation. We can skip
351 // in that case as we are only registering a scrollbar and because opacity 351 // updating opacity in that case as we are only registering a scrollbar and
352 // will be overwritten anyway when property trees are pushed. 352 // because opacity will be overwritten anyway when property trees are
353 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, 353 // pushed.
354 scrollbar->id())) { 354 if (property_trees->effect_tree.FindNodeIndexFromOwningLayerId(
355 scrollbar->id()) != EffectTree::kInvalidNodeId) {
355 property_trees->effect_tree.OnOpacityAnimated( 356 property_trees->effect_tree.OnOpacityAnimated(
356 effective_opacity, 357 effective_opacity,
357 property_trees->layer_id_to_effect_node_index[scrollbar->id()], 358 property_trees->effect_tree.FindNodeIndexFromOwningLayerId(
359 scrollbar->id()),
358 scrollbar->layer_tree_impl()); 360 scrollbar->layer_tree_impl());
359 } 361 }
360 } 362 }
361 363
362 bool previouslyVisible = opacity_ > 0.0f; 364 bool previouslyVisible = opacity_ > 0.0f;
363 bool currentlyVisible = opacity > 0.0f; 365 bool currentlyVisible = opacity > 0.0f;
364 366
365 opacity_ = opacity; 367 opacity_ = opacity;
366 368
367 if (previouslyVisible != currentlyVisible) 369 if (previouslyVisible != currentlyVisible)
368 client_->DidChangeScrollbarVisibility(); 370 client_->DidChangeScrollbarVisibility();
369 } 371 }
370 372
371 } // namespace cc 373 } // 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