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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 SetNeedsCommit(); | 670 SetNeedsCommit(); |
671 } | 671 } |
672 | 672 |
673 void Layer::RemoveClipChild(Layer* child) { | 673 void Layer::RemoveClipChild(Layer* child) { |
674 clip_children_->erase(child); | 674 clip_children_->erase(child); |
675 if (clip_children_->empty()) | 675 if (clip_children_->empty()) |
676 clip_children_.reset(); | 676 clip_children_.reset(); |
677 SetNeedsCommit(); | 677 SetNeedsCommit(); |
678 } | 678 } |
679 | 679 |
680 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 680 void Layer::SetScrollOffset(const gfx::Vector2d& scroll_offset) { |
681 DCHECK(IsPropertyChangeAllowed()); | 681 DCHECK(IsPropertyChangeAllowed()); |
682 if (scroll_offset_ == scroll_offset) | 682 if (scroll_offset_ == scroll_offset) |
683 return; | 683 return; |
684 scroll_offset_ = scroll_offset; | 684 scroll_offset_ = scroll_offset; |
685 SetNeedsCommit(); | 685 SetNeedsCommit(); |
686 } | 686 } |
687 | 687 |
688 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { | 688 void Layer::SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset) { |
689 DCHECK(IsPropertyChangeAllowed()); | 689 DCHECK(IsPropertyChangeAllowed()); |
690 // This function only gets called during a BeginMainFrame, so there | 690 // This function only gets called during a BeginMainFrame, so there |
691 // is no need to call SetNeedsUpdate here. | 691 // is no need to call SetNeedsUpdate here. |
692 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 692 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
693 if (scroll_offset_ == scroll_offset) | 693 if (scroll_offset_ == scroll_offset) |
694 return; | 694 return; |
695 scroll_offset_ = scroll_offset; | 695 scroll_offset_ = scroll_offset; |
696 SetNeedsPushProperties(); | 696 SetNeedsPushProperties(); |
697 if (!did_scroll_callback_.is_null()) | 697 if (!did_scroll_callback_.is_null()) |
698 did_scroll_callback_.Run(); | 698 did_scroll_callback_.Run(); |
699 // The callback could potentially change the layer structure: | 699 // The callback could potentially change the layer structure: |
700 // "this" may have been destroyed during the process. | 700 // "this" may have been destroyed during the process. |
701 } | 701 } |
702 | 702 |
703 void Layer::SetMaxScrollOffset(gfx::Vector2d max_scroll_offset) { | 703 void Layer::SetMaxScrollOffset(const gfx::Vector2d& max_scroll_offset) { |
704 DCHECK(IsPropertyChangeAllowed()); | 704 DCHECK(IsPropertyChangeAllowed()); |
705 if (max_scroll_offset_ == max_scroll_offset) | 705 if (max_scroll_offset_ == max_scroll_offset) |
706 return; | 706 return; |
707 max_scroll_offset_ = max_scroll_offset; | 707 max_scroll_offset_ = max_scroll_offset; |
708 SetNeedsCommit(); | 708 SetNeedsCommit(); |
709 } | 709 } |
710 | 710 |
711 void Layer::SetScrollable(bool scrollable) { | 711 void Layer::SetScrollable(bool scrollable) { |
712 DCHECK(IsPropertyChangeAllowed()); | 712 DCHECK(IsPropertyChangeAllowed()); |
713 if (scrollable_ == scrollable) | 713 if (scrollable_ == scrollable) |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 clip_parent_->RemoveClipChild(this); | 1166 clip_parent_->RemoveClipChild(this); |
1167 | 1167 |
1168 clip_parent_ = NULL; | 1168 clip_parent_ = NULL; |
1169 } | 1169 } |
1170 | 1170 |
1171 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1171 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1172 benchmark->RunOnLayer(this); | 1172 benchmark->RunOnLayer(this); |
1173 } | 1173 } |
1174 | 1174 |
1175 } // namespace cc | 1175 } // namespace cc |
OLD | NEW |