| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/debug/trace_event_argument.h" | 8 #include "base/debug/trace_event_argument.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 use_parent_backface_visibility_(false), | 57 use_parent_backface_visibility_(false), |
| 58 draw_checkerboard_for_missing_tiles_(false), | 58 draw_checkerboard_for_missing_tiles_(false), |
| 59 draws_content_(false), | 59 draws_content_(false), |
| 60 hide_layer_and_subtree_(false), | 60 hide_layer_and_subtree_(false), |
| 61 force_render_surface_(false), | 61 force_render_surface_(false), |
| 62 transform_is_invertible_(true), | 62 transform_is_invertible_(true), |
| 63 is_container_for_fixed_position_layers_(false), | 63 is_container_for_fixed_position_layers_(false), |
| 64 background_color_(0), | 64 background_color_(0), |
| 65 opacity_(1.0), | 65 opacity_(1.0), |
| 66 blend_mode_(SkXfermode::kSrcOver_Mode), | 66 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 67 num_descendants_that_draw_content_(0), |
| 67 draw_depth_(0.f), | 68 draw_depth_(0.f), |
| 68 needs_push_properties_(false), | 69 needs_push_properties_(false), |
| 69 num_dependents_need_push_properties_(0), | 70 num_dependents_need_push_properties_(0), |
| 70 sorting_context_id_(0), | 71 sorting_context_id_(0), |
| 71 current_draw_mode_(DRAW_MODE_NONE) { | 72 current_draw_mode_(DRAW_MODE_NONE) { |
| 72 DCHECK_GT(layer_id_, 0); | 73 DCHECK_GT(layer_id_, 0); |
| 73 DCHECK(layer_tree_impl_); | 74 DCHECK(layer_tree_impl_); |
| 74 layer_tree_impl_->RegisterLayer(this); | 75 layer_tree_impl_->RegisterLayer(this); |
| 75 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); | 76 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); |
| 76 layer_animation_controller_ = | 77 layer_animation_controller_ = |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 SetNeedsPushProperties(); | 170 SetNeedsPushProperties(); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) { | 173 void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) { |
| 173 if (scroll_children_.get() == children) | 174 if (scroll_children_.get() == children) |
| 174 return; | 175 return; |
| 175 scroll_children_.reset(children); | 176 scroll_children_.reset(children); |
| 176 SetNeedsPushProperties(); | 177 SetNeedsPushProperties(); |
| 177 } | 178 } |
| 178 | 179 |
| 180 void LayerImpl::SetNumDescendantsThatDrawContent(int num_descendants) { |
| 181 if (num_descendants_that_draw_content_ == num_descendants) |
| 182 return; |
| 183 num_descendants_that_draw_content_ = num_descendants; |
| 184 SetNeedsPushProperties(); |
| 185 } |
| 186 |
| 179 void LayerImpl::SetClipParent(LayerImpl* ancestor) { | 187 void LayerImpl::SetClipParent(LayerImpl* ancestor) { |
| 180 if (clip_parent_ == ancestor) | 188 if (clip_parent_ == ancestor) |
| 181 return; | 189 return; |
| 182 | 190 |
| 183 clip_parent_ = ancestor; | 191 clip_parent_ = ancestor; |
| 184 SetNeedsPushProperties(); | 192 SetNeedsPushProperties(); |
| 185 } | 193 } |
| 186 | 194 |
| 187 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) { | 195 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) { |
| 188 if (clip_children_.get() == children) | 196 if (clip_children_.get() == children) |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 533 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
| 526 | 534 |
| 527 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() | 535 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() |
| 528 : Layer::INVALID_ID); | 536 : Layer::INVALID_ID); |
| 529 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 537 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 530 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 538 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 531 layer->SetScrollOffsetAndDelta( | 539 layer->SetScrollOffsetAndDelta( |
| 532 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 540 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
| 533 layer->SetSentScrollDelta(gfx::Vector2d()); | 541 layer->SetSentScrollDelta(gfx::Vector2d()); |
| 534 layer->Set3dSortingContextId(sorting_context_id_); | 542 layer->Set3dSortingContextId(sorting_context_id_); |
| 543 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); |
| 535 | 544 |
| 536 LayerImpl* scroll_parent = NULL; | 545 LayerImpl* scroll_parent = NULL; |
| 537 if (scroll_parent_) { | 546 if (scroll_parent_) { |
| 538 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 547 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 539 DCHECK(scroll_parent); | 548 DCHECK(scroll_parent); |
| 540 } | 549 } |
| 541 | 550 |
| 542 layer->SetScrollParent(scroll_parent); | 551 layer->SetScrollParent(scroll_parent); |
| 543 if (scroll_children_) { | 552 if (scroll_children_) { |
| 544 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; | 553 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 return draw_properties_.last_drawn_render_surface_layer_list_id == | 1523 return draw_properties_.last_drawn_render_surface_layer_list_id == |
| 1515 layer_tree_impl_->current_render_surface_list_id(); | 1524 layer_tree_impl_->current_render_surface_list_id(); |
| 1516 } | 1525 } |
| 1517 | 1526 |
| 1518 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1527 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
| 1519 | 1528 |
| 1520 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1529 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1521 benchmark->RunOnLayer(this); | 1530 benchmark->RunOnLayer(this); |
| 1522 } | 1531 } |
| 1523 | 1532 |
| 1533 int LayerImpl::NumDescendantsThatDrawContent() const { |
| 1534 return num_descendants_that_draw_content_; |
| 1535 } |
| 1536 |
| 1524 void LayerImpl::NotifyAnimationFinished( | 1537 void LayerImpl::NotifyAnimationFinished( |
| 1525 base::TimeTicks monotonic_time, | 1538 base::TimeTicks monotonic_time, |
| 1526 Animation::TargetProperty target_property) { | 1539 Animation::TargetProperty target_property) { |
| 1527 if (target_property == Animation::ScrollOffset) | 1540 if (target_property == Animation::ScrollOffset) |
| 1528 layer_tree_impl_->InputScrollAnimationFinished(); | 1541 layer_tree_impl_->InputScrollAnimationFinished(); |
| 1529 } | 1542 } |
| 1530 | 1543 |
| 1531 } // namespace cc | 1544 } // namespace cc |
| OLD | NEW |