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/location.h" | 10 #include "base/location.h" |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 DCHECK_EQ((*it)->clip_parent(), this); | 971 DCHECK_EQ((*it)->clip_parent(), this); |
972 LayerImpl* clip_child = layer->layer_tree_impl()->LayerById((*it)->id()); | 972 LayerImpl* clip_child = layer->layer_tree_impl()->LayerById((*it)->id()); |
973 DCHECK(clip_child); | 973 DCHECK(clip_child); |
974 clip_children->insert(clip_child); | 974 clip_children->insert(clip_child); |
975 } | 975 } |
976 layer->SetClipChildren(clip_children); | 976 layer->SetClipChildren(clip_children); |
977 } else { | 977 } else { |
978 layer->SetClipChildren(nullptr); | 978 layer->SetClipChildren(nullptr); |
979 } | 979 } |
980 | 980 |
981 // Adjust the scroll delta to be just the scrolls that have happened since | 981 layer->PushScrollOffsetFromMainThread(scroll_offset_); |
982 // the BeginMainFrame was sent. This happens for impl-side painting | 982 if (layer_animation_controller_->scroll_offset_animation_was_interrupted() && |
983 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. | 983 layer->IsActive()) |
984 if (layer->layer_tree_impl()->settings().impl_side_painting) { | 984 layer->SetScrollDelta(gfx::Vector2dF()); |
985 layer->SetScrollOffset(scroll_offset_); | |
986 } else { | |
987 if (layer_animation_controller_ | |
988 ->scroll_offset_animation_was_interrupted()) { | |
989 layer->SetScrollOffsetAndDelta(scroll_offset_, gfx::Vector2dF()); | |
990 } else { | |
991 layer->SetScrollOffsetAndDelta( | |
992 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); | |
993 } | |
994 layer->SetSentScrollDelta(gfx::Vector2dF()); | |
995 } | |
996 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment()); | 985 layer->SetScrollCompensationAdjustment(ScrollCompensationAdjustment()); |
997 | 986 |
998 // Wrap the copy_requests_ in a PostTask to the main thread. | 987 // Wrap the copy_requests_ in a PostTask to the main thread. |
999 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; | 988 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; |
1000 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); | 989 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); |
1001 it != copy_requests_.end(); | 990 it != copy_requests_.end(); |
1002 ++it) { | 991 ++it) { |
1003 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 992 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
1004 layer_tree_host()->proxy()->MainThreadTaskRunner(); | 993 layer_tree_host()->proxy()->MainThreadTaskRunner(); |
1005 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); | 994 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); |
(...skipping 28 matching lines...) Expand all Loading... |
1034 | 1023 |
1035 // Reset any state that should be cleared for the next update. | 1024 // Reset any state that should be cleared for the next update. |
1036 stacking_order_changed_ = false; | 1025 stacking_order_changed_ = false; |
1037 update_rect_ = gfx::Rect(); | 1026 update_rect_ = gfx::Rect(); |
1038 | 1027 |
1039 needs_push_properties_ = false; | 1028 needs_push_properties_ = false; |
1040 num_dependents_need_push_properties_ = 0; | 1029 num_dependents_need_push_properties_ = 0; |
1041 } | 1030 } |
1042 | 1031 |
1043 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 1032 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
1044 return LayerImpl::Create(tree_impl, layer_id_); | 1033 return LayerImpl::Create(tree_impl, layer_id_, |
| 1034 new LayerImpl::SyncedScrollOffset); |
1045 } | 1035 } |
1046 | 1036 |
1047 bool Layer::DrawsContent() const { | 1037 bool Layer::DrawsContent() const { |
1048 return draws_content_; | 1038 return draws_content_; |
1049 } | 1039 } |
1050 | 1040 |
1051 bool Layer::HasDrawableContent() const { | 1041 bool Layer::HasDrawableContent() const { |
1052 return is_drawable_; | 1042 return is_drawable_; |
1053 } | 1043 } |
1054 | 1044 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 void Layer::ClearRenderSurface() { | 1118 void Layer::ClearRenderSurface() { |
1129 render_surface_ = nullptr; | 1119 render_surface_ = nullptr; |
1130 } | 1120 } |
1131 | 1121 |
1132 void Layer::ClearRenderSurfaceLayerList() { | 1122 void Layer::ClearRenderSurfaceLayerList() { |
1133 if (render_surface_) | 1123 if (render_surface_) |
1134 render_surface_->ClearLayerLists(); | 1124 render_surface_->ClearLayerLists(); |
1135 } | 1125 } |
1136 | 1126 |
1137 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { | 1127 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { |
1138 return TotalScrollOffset(); | 1128 return CurrentScrollOffset(); |
1139 } | 1129 } |
1140 | 1130 |
1141 // On<Property>Animated is called due to an ongoing accelerated animation. | 1131 // On<Property>Animated is called due to an ongoing accelerated animation. |
1142 // Since this animation is also being run on the compositor thread, there | 1132 // Since this animation is also being run on the compositor thread, there |
1143 // is no need to request a commit to push this value over, so the value is | 1133 // is no need to request a commit to push this value over, so the value is |
1144 // set directly rather than by calling Set<Property>. | 1134 // set directly rather than by calling Set<Property>. |
1145 void Layer::OnFilterAnimated(const FilterOperations& filters) { | 1135 void Layer::OnFilterAnimated(const FilterOperations& filters) { |
1146 filters_ = filters; | 1136 filters_ = filters; |
1147 } | 1137 } |
1148 | 1138 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } | 1297 } |
1308 | 1298 |
1309 void Layer::SetFrameTimingRequests( | 1299 void Layer::SetFrameTimingRequests( |
1310 const std::vector<FrameTimingRequest>& requests) { | 1300 const std::vector<FrameTimingRequest>& requests) { |
1311 frame_timing_requests_ = requests; | 1301 frame_timing_requests_ = requests; |
1312 frame_timing_requests_dirty_ = true; | 1302 frame_timing_requests_dirty_ = true; |
1313 SetNeedsCommit(); | 1303 SetNeedsCommit(); |
1314 } | 1304 } |
1315 | 1305 |
1316 } // namespace cc | 1306 } // namespace cc |
OLD | NEW |