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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { | 666 void Layer::SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { |
667 DCHECK(IsPropertyChangeAllowed()); | 667 DCHECK(IsPropertyChangeAllowed()); |
668 | 668 |
669 if (scroll_offset_ == scroll_offset) | 669 if (scroll_offset_ == scroll_offset) |
670 return; | 670 return; |
671 scroll_offset_ = scroll_offset; | 671 scroll_offset_ = scroll_offset; |
672 SetNeedsCommit(); | 672 SetNeedsCommit(); |
673 } | 673 } |
674 | 674 |
675 void Layer::SetScrollOffsetFractionalPart( | 675 void Layer::SetScrollCompensationAdjustment( |
676 const gfx::Vector2dF& scroll_offset_fractional_part) { | 676 const gfx::Vector2dF& scroll_compensation_adjustment) { |
677 if (scroll_offset_fractional_part_ == scroll_offset_fractional_part) | 677 if (scroll_compensation_adjustment_ == scroll_compensation_adjustment) |
678 return; | 678 return; |
679 scroll_offset_fractional_part_ = scroll_offset_fractional_part; | 679 scroll_compensation_adjustment_ = scroll_compensation_adjustment; |
680 SetNeedsCommit(); | 680 SetNeedsCommit(); |
681 } | 681 } |
682 | 682 |
683 gfx::Vector2dF Layer::MainScrollOffsetFractionalPart() const { | 683 gfx::Vector2dF Layer::ScrollCompensationAdjustment() const { |
684 return scroll_offset_fractional_part_; | 684 return scroll_compensation_adjustment_; |
685 } | 685 } |
686 | 686 |
687 void Layer::SetScrollOffsetFromImplSide( | 687 void Layer::SetScrollOffsetFromImplSide( |
688 const gfx::ScrollOffset& scroll_offset) { | 688 const gfx::ScrollOffset& 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; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 } else { | 986 } else { |
987 if (layer_animation_controller_ | 987 if (layer_animation_controller_ |
988 ->scroll_offset_animation_was_interrupted()) { | 988 ->scroll_offset_animation_was_interrupted()) { |
989 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); | 989 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); |
990 } else { | 990 } else { |
991 layer->SetScrollOffsetAndDelta( | 991 layer->SetScrollOffsetAndDelta( |
992 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 992 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
993 } | 993 } |
994 layer->SetSentScrollDelta(gfx::Vector2dF()); | 994 layer->SetSentScrollDelta(gfx::Vector2dF()); |
995 } | 995 } |
996 layer->SetMainScrollOffsetFractionalPart(MainScrollOffsetFractionalPart()); | 996 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment()); |
997 | 997 |
998 // Wrap the copy_requests_ in a PostTask to the main thread. | 998 // Wrap the copy_requests_ in a PostTask to the main thread. |
999 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; | 999 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; |
1000 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); | 1000 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); |
1001 it != copy_requests_.end(); | 1001 it != copy_requests_.end(); |
1002 ++it) { | 1002 ++it) { |
1003 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 1003 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
1004 layer_tree_host()->proxy()->MainThreadTaskRunner(); | 1004 layer_tree_host()->proxy()->MainThreadTaskRunner(); |
1005 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); | 1005 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); |
1006 const CopyOutputRequest& original_request_ref = *original_request; | 1006 const CopyOutputRequest& original_request_ref = *original_request; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } | 1307 } |
1308 | 1308 |
1309 void Layer::SetFrameTimingRequests( | 1309 void Layer::SetFrameTimingRequests( |
1310 const std::vector<FrameTimingRequest>& requests) { | 1310 const std::vector<FrameTimingRequest>& requests) { |
1311 frame_timing_requests_ = requests; | 1311 frame_timing_requests_ = requests; |
1312 frame_timing_requests_dirty_ = true; | 1312 frame_timing_requests_dirty_ = true; |
1313 SetNeedsCommit(); | 1313 SetNeedsCommit(); |
1314 } | 1314 } |
1315 | 1315 |
1316 } // namespace cc | 1316 } // namespace cc |
OLD | NEW |