OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 blend_mode_(SkXfermode::kSrcOver_Mode), | 93 blend_mode_(SkXfermode::kSrcOver_Mode), |
94 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 94 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
95 scroll_parent_(nullptr), | 95 scroll_parent_(nullptr), |
96 layer_or_descendant_is_drawn_tracker_(0), | 96 layer_or_descendant_is_drawn_tracker_(0), |
97 sorted_for_recursion_tracker_(0), | 97 sorted_for_recursion_tracker_(0), |
98 visited_tracker_(0), | 98 visited_tracker_(0), |
99 clip_parent_(nullptr), | 99 clip_parent_(nullptr), |
100 replica_layer_(nullptr), | 100 replica_layer_(nullptr), |
101 client_(nullptr), | 101 client_(nullptr), |
102 num_unclipped_descendants_(0), | 102 num_unclipped_descendants_(0), |
103 frame_timing_requests_dirty_(false) { | 103 frame_timing_requests_dirty_(false), |
| 104 is_hidden_from_property_trees_(false) { |
104 if (!settings.use_compositor_animation_timelines) { | 105 if (!settings.use_compositor_animation_timelines) { |
105 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 106 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
106 layer_animation_controller_->AddValueObserver(this); | 107 layer_animation_controller_->AddValueObserver(this); |
107 layer_animation_controller_->set_value_provider(this); | 108 layer_animation_controller_->set_value_provider(this); |
108 } | 109 } |
109 } | 110 } |
110 | 111 |
111 Layer::~Layer() { | 112 Layer::~Layer() { |
112 // Our parent should be holding a reference to us so there should be no | 113 // Our parent should be holding a reference to us so there should be no |
113 // way for us to be destroyed while we still have a parent. | 114 // way for us to be destroyed while we still have a parent. |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 532 } |
532 | 533 |
533 void Layer::SetOpacity(float opacity) { | 534 void Layer::SetOpacity(float opacity) { |
534 DCHECK(IsPropertyChangeAllowed()); | 535 DCHECK(IsPropertyChangeAllowed()); |
535 if (opacity_ == opacity) | 536 if (opacity_ == opacity) |
536 return; | 537 return; |
537 opacity_ = opacity; | 538 opacity_ = opacity; |
538 SetNeedsCommit(); | 539 SetNeedsCommit(); |
539 } | 540 } |
540 | 541 |
541 float Layer::EffectiveOpacity() const { | |
542 return hide_layer_and_subtree_ ? 0.f : opacity_; | |
543 } | |
544 | |
545 bool Layer::OpacityIsAnimating() const { | 542 bool Layer::OpacityIsAnimating() const { |
546 DCHECK(layer_tree_host_); | 543 DCHECK(layer_tree_host_); |
547 return layer_animation_controller_ | 544 return layer_animation_controller_ |
548 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | 545 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( |
549 Animation::OPACITY, | 546 Animation::OPACITY, |
550 LayerAnimationController::ObserverType::ACTIVE) | 547 LayerAnimationController::ObserverType::ACTIVE) |
551 : layer_tree_host_->IsAnimatingOpacityProperty(this); | 548 : layer_tree_host_->IsAnimatingOpacityProperty(this); |
552 } | 549 } |
553 | 550 |
554 bool Layer::HasPotentiallyRunningOpacityAnimation() const { | 551 bool Layer::HasPotentiallyRunningOpacityAnimation() const { |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 1234 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
1238 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 1235 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
1239 layer->Set3dSortingContextId(sorting_context_id_); | 1236 layer->Set3dSortingContextId(sorting_context_id_); |
1240 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); | 1237 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
1241 | 1238 |
1242 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 1239 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
1243 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 1240 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
1244 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 1241 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
1245 layer->SetElementId(element_id_); | 1242 layer->SetElementId(element_id_); |
1246 layer->SetMutableProperties(mutable_properties_); | 1243 layer->SetMutableProperties(mutable_properties_); |
| 1244 layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_); |
1247 | 1245 |
1248 LayerImpl* scroll_parent = nullptr; | 1246 LayerImpl* scroll_parent = nullptr; |
1249 if (scroll_parent_) { | 1247 if (scroll_parent_) { |
1250 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 1248 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
1251 DCHECK(scroll_parent); | 1249 DCHECK(scroll_parent); |
1252 } | 1250 } |
1253 | 1251 |
1254 layer->SetScrollParent(scroll_parent); | 1252 layer->SetScrollParent(scroll_parent); |
1255 if (scroll_children_) { | 1253 if (scroll_children_) { |
1256 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 1254 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 this, layer_tree_host_->property_trees()->transform_tree); | 2032 this, layer_tree_host_->property_trees()->transform_tree); |
2035 } | 2033 } |
2036 | 2034 |
2037 gfx::Transform Layer::screen_space_transform() const { | 2035 gfx::Transform Layer::screen_space_transform() const { |
2038 DCHECK_NE(transform_tree_index_, -1); | 2036 DCHECK_NE(transform_tree_index_, -1); |
2039 return ScreenSpaceTransformFromPropertyTrees( | 2037 return ScreenSpaceTransformFromPropertyTrees( |
2040 this, layer_tree_host_->property_trees()->transform_tree); | 2038 this, layer_tree_host_->property_trees()->transform_tree); |
2041 } | 2039 } |
2042 | 2040 |
2043 } // namespace cc | 2041 } // namespace cc |
OLD | NEW |