| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 void Layer::AddScrollChild(Layer* child) { | 613 void Layer::AddScrollChild(Layer* child) { |
| 614 if (!scroll_children_) | 614 if (!scroll_children_) |
| 615 scroll_children_.reset(new std::set<Layer*>); | 615 scroll_children_.reset(new std::set<Layer*>); |
| 616 scroll_children_->insert(child); | 616 scroll_children_->insert(child); |
| 617 SetNeedsCommit(); | 617 SetNeedsCommit(); |
| 618 } | 618 } |
| 619 | 619 |
| 620 void Layer::RemoveScrollChild(Layer* child) { | 620 void Layer::RemoveScrollChild(Layer* child) { |
| 621 scroll_children_->erase(child); | 621 scroll_children_->erase(child); |
| 622 if (scroll_children_->empty()) | 622 if (scroll_children_->empty()) |
| 623 scroll_children_.reset(); | 623 scroll_children_ = nullptr; |
| 624 SetNeedsCommit(); | 624 SetNeedsCommit(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 void Layer::SetClipParent(Layer* ancestor) { | 627 void Layer::SetClipParent(Layer* ancestor) { |
| 628 DCHECK(IsPropertyChangeAllowed()); | 628 DCHECK(IsPropertyChangeAllowed()); |
| 629 if (clip_parent_ == ancestor) | 629 if (clip_parent_ == ancestor) |
| 630 return; | 630 return; |
| 631 | 631 |
| 632 if (clip_parent_) | 632 if (clip_parent_) |
| 633 clip_parent_->RemoveClipChild(this); | 633 clip_parent_->RemoveClipChild(this); |
| 634 | 634 |
| 635 clip_parent_ = ancestor; | 635 clip_parent_ = ancestor; |
| 636 | 636 |
| 637 if (clip_parent_) | 637 if (clip_parent_) |
| 638 clip_parent_->AddClipChild(this); | 638 clip_parent_->AddClipChild(this); |
| 639 | 639 |
| 640 SetNeedsCommit(); | 640 SetNeedsCommit(); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void Layer::AddClipChild(Layer* child) { | 643 void Layer::AddClipChild(Layer* child) { |
| 644 if (!clip_children_) | 644 if (!clip_children_) |
| 645 clip_children_.reset(new std::set<Layer*>); | 645 clip_children_.reset(new std::set<Layer*>); |
| 646 clip_children_->insert(child); | 646 clip_children_->insert(child); |
| 647 SetNeedsCommit(); | 647 SetNeedsCommit(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 void Layer::RemoveClipChild(Layer* child) { | 650 void Layer::RemoveClipChild(Layer* child) { |
| 651 clip_children_->erase(child); | 651 clip_children_->erase(child); |
| 652 if (clip_children_->empty()) | 652 if (clip_children_->empty()) |
| 653 clip_children_.reset(); | 653 clip_children_ = nullptr; |
| 654 SetNeedsCommit(); | 654 SetNeedsCommit(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 657 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { |
| 658 DCHECK(IsPropertyChangeAllowed()); | 658 DCHECK(IsPropertyChangeAllowed()); |
| 659 | 659 |
| 660 if (scroll_offset_ == scroll_offset) | 660 if (scroll_offset_ == scroll_offset) |
| 661 return; | 661 return; |
| 662 scroll_offset_ = scroll_offset; | 662 scroll_offset_ = scroll_offset; |
| 663 SetNeedsCommit(); | 663 SetNeedsCommit(); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 return NULL; | 1078 return NULL; |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 void Layer::CreateRenderSurface() { | 1081 void Layer::CreateRenderSurface() { |
| 1082 DCHECK(!draw_properties_.render_surface); | 1082 DCHECK(!draw_properties_.render_surface); |
| 1083 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); | 1083 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); |
| 1084 draw_properties_.render_target = this; | 1084 draw_properties_.render_target = this; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 void Layer::ClearRenderSurface() { | 1087 void Layer::ClearRenderSurface() { |
| 1088 draw_properties_.render_surface.reset(); | 1088 draw_properties_.render_surface = nullptr; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 void Layer::ClearRenderSurfaceLayerList() { | 1091 void Layer::ClearRenderSurfaceLayerList() { |
| 1092 if (draw_properties_.render_surface) | 1092 if (draw_properties_.render_surface) |
| 1093 draw_properties_.render_surface->layer_list().clear(); | 1093 draw_properties_.render_surface->layer_list().clear(); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const { | 1096 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const { |
| 1097 return TotalScrollOffset(); | 1097 return TotalScrollOffset(); |
| 1098 } | 1098 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1233 |
| 1234 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1234 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1235 benchmark->RunOnLayer(this); | 1235 benchmark->RunOnLayer(this); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 bool Layer::HasDelegatedContent() const { | 1238 bool Layer::HasDelegatedContent() const { |
| 1239 return false; | 1239 return false; |
| 1240 } | 1240 } |
| 1241 | 1241 |
| 1242 } // namespace cc | 1242 } // namespace cc |
| OLD | NEW |