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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 clip_children_ = nullptr; | 662 clip_children_ = nullptr; |
663 SetNeedsCommit(); | 663 SetNeedsCommit(); |
664 } | 664 } |
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 scroll_offset_fractional_part_ = scroll_offset.DeltaFrom( | |
aelias_OOO_until_Jul13
2015/01/28 02:04:00
I see Dana made the comment on your doc "This seem
Yufeng Shen (Slow to review)
2015/01/28 04:49:23
would an API that takes 2 parameters be better ?
e
aelias_OOO_until_Jul13
2015/01/28 05:50:29
I'd rather keep them separate, it makes sense not
Yufeng Shen (Slow to review)
2015/01/28 22:28:09
Done.
| |
673 gfx::ScrollOffset(gfx::ScrollOffsetToFlooredVector2d(scroll_offset))); | |
672 SetNeedsCommit(); | 674 SetNeedsCommit(); |
673 } | 675 } |
674 | 676 |
675 void Layer::SetScrollOffsetFromImplSide( | 677 void Layer::SetScrollOffsetFromImplSide( |
676 const gfx::ScrollOffset& scroll_offset) { | 678 const gfx::ScrollOffset& scroll_offset) { |
677 DCHECK(IsPropertyChangeAllowed()); | 679 DCHECK(IsPropertyChangeAllowed()); |
678 // This function only gets called during a BeginMainFrame, so there | 680 // This function only gets called during a BeginMainFrame, so there |
679 // is no need to call SetNeedsUpdate here. | 681 // is no need to call SetNeedsUpdate here. |
680 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 682 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
681 if (scroll_offset_ == scroll_offset) | 683 if (scroll_offset_ == scroll_offset) |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
974 } else { | 976 } else { |
975 if (layer_animation_controller_ | 977 if (layer_animation_controller_ |
976 ->scroll_offset_animation_was_interrupted()) { | 978 ->scroll_offset_animation_was_interrupted()) { |
977 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); | 979 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); |
978 } else { | 980 } else { |
979 layer->SetScrollOffsetAndDelta( | 981 layer->SetScrollOffsetAndDelta( |
980 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | 982 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); |
981 } | 983 } |
982 layer->SetSentScrollDelta(gfx::Vector2dF()); | 984 layer->SetSentScrollDelta(gfx::Vector2dF()); |
983 } | 985 } |
986 layer->SetMainScrollOffsetFractionalPart(scroll_offset_fractional_part_); | |
984 | 987 |
985 // Wrap the copy_requests_ in a PostTask to the main thread. | 988 // Wrap the copy_requests_ in a PostTask to the main thread. |
986 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; | 989 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; |
987 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); | 990 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); |
988 it != copy_requests_.end(); | 991 it != copy_requests_.end(); |
989 ++it) { | 992 ++it) { |
990 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 993 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
991 layer_tree_host()->proxy()->MainThreadTaskRunner(); | 994 layer_tree_host()->proxy()->MainThreadTaskRunner(); |
992 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); | 995 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); |
993 const CopyOutputRequest& original_request_ref = *original_request; | 996 const CopyOutputRequest& original_request_ref = *original_request; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 } | 1297 } |
1295 | 1298 |
1296 void Layer::SetFrameTimingRequests( | 1299 void Layer::SetFrameTimingRequests( |
1297 const std::vector<FrameTimingRequest>& requests) { | 1300 const std::vector<FrameTimingRequest>& requests) { |
1298 frame_timing_requests_ = requests; | 1301 frame_timing_requests_ = requests; |
1299 frame_timing_requests_dirty_ = true; | 1302 frame_timing_requests_dirty_ = true; |
1300 SetNeedsCommit(); | 1303 SetNeedsCommit(); |
1301 } | 1304 } |
1302 | 1305 |
1303 } // namespace cc | 1306 } // namespace cc |
OLD | NEW |