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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_.reset(); |
654 SetNeedsCommit(); | 654 SetNeedsCommit(); |
655 } | 655 } |
656 | 656 |
657 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 657 void Layer::SetScrollOffset(gfx::Vector2dF 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(); |
664 } | 664 } |
665 | 665 |
666 void Layer::SetScrollOffsetFromImplSide(const gfx::Vector2d& scroll_offset) { | 666 void Layer::SetScrollOffsetFromImplSide(const gfx::Vector2dF& scroll_offset) { |
667 DCHECK(IsPropertyChangeAllowed()); | 667 DCHECK(IsPropertyChangeAllowed()); |
668 // This function only gets called during a BeginMainFrame, so there | 668 // This function only gets called during a BeginMainFrame, so there |
669 // is no need to call SetNeedsUpdate here. | 669 // is no need to call SetNeedsUpdate here. |
670 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 670 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
671 if (scroll_offset_ == scroll_offset) | 671 if (scroll_offset_ == scroll_offset) |
672 return; | 672 return; |
673 scroll_offset_ = scroll_offset; | 673 scroll_offset_ = scroll_offset; |
674 SetNeedsPushProperties(); | 674 SetNeedsPushProperties(); |
675 if (!did_scroll_callback_.is_null()) | 675 if (!did_scroll_callback_.is_null()) |
676 did_scroll_callback_.Run(); | 676 did_scroll_callback_.Run(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 } | 957 } |
958 | 958 |
959 // Adjust the scroll delta to be just the scrolls that have happened since | 959 // Adjust the scroll delta to be just the scrolls that have happened since |
960 // the BeginMainFrame was sent. This happens for impl-side painting | 960 // the BeginMainFrame was sent. This happens for impl-side painting |
961 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. | 961 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. |
962 if (layer->layer_tree_impl()->settings().impl_side_painting) { | 962 if (layer->layer_tree_impl()->settings().impl_side_painting) { |
963 layer->SetScrollOffset(scroll_offset_); | 963 layer->SetScrollOffset(scroll_offset_); |
964 } else { | 964 } else { |
965 layer->SetScrollOffsetAndDelta( | 965 layer->SetScrollOffsetAndDelta( |
966 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 966 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
967 layer->SetSentScrollDelta(gfx::Vector2d()); | 967 layer->SetSentScrollDelta(gfx::Vector2dF()); |
968 } | 968 } |
969 | 969 |
970 // Wrap the copy_requests_ in a PostTask to the main thread. | 970 // Wrap the copy_requests_ in a PostTask to the main thread. |
971 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; | 971 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; |
972 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); | 972 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); |
973 it != copy_requests_.end(); | 973 it != copy_requests_.end(); |
974 ++it) { | 974 ++it) { |
975 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 975 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
976 layer_tree_host()->proxy()->MainThreadTaskRunner(); | 976 layer_tree_host()->proxy()->MainThreadTaskRunner(); |
977 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); | 977 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); |
(...skipping 255 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 |