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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 DCHECK_EQ((*it)->clip_parent(), this); | 958 DCHECK_EQ((*it)->clip_parent(), this); |
959 LayerImpl* clip_child = layer->layer_tree_impl()->LayerById((*it)->id()); | 959 LayerImpl* clip_child = layer->layer_tree_impl()->LayerById((*it)->id()); |
960 DCHECK(clip_child); | 960 DCHECK(clip_child); |
961 clip_children->insert(clip_child); | 961 clip_children->insert(clip_child); |
962 } | 962 } |
963 layer->SetClipChildren(clip_children); | 963 layer->SetClipChildren(clip_children); |
964 } else { | 964 } else { |
965 layer->SetClipChildren(nullptr); | 965 layer->SetClipChildren(nullptr); |
966 } | 966 } |
967 | 967 |
968 // Adjust the scroll delta to be just the scrolls that have happened since | 968 layer->PushScrollOffsetFromMainThread(scroll_offset_); |
969 // the BeginMainFrame was sent. This happens for impl-side painting | |
970 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. | |
971 if (layer->layer_tree_impl()->settings().impl_side_painting) { | |
972 layer->SetScrollOffset(scroll_offset_); | |
973 } else { | |
974 layer->SetScrollOffsetAndDelta( | |
975 scroll_offset_, | |
976 layer->ScrollDelta() - layer->sent_scroll_delta()); | |
977 layer->SetSentScrollDelta(gfx::Vector2dF()); | |
978 } | |
979 | 969 |
980 // Wrap the copy_requests_ in a PostTask to the main thread. | 970 // Wrap the copy_requests_ in a PostTask to the main thread. |
981 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; | 971 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; |
982 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); | 972 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); |
983 it != copy_requests_.end(); | 973 it != copy_requests_.end(); |
984 ++it) { | 974 ++it) { |
985 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = | 975 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = |
986 layer_tree_host()->proxy()->MainThreadTaskRunner(); | 976 layer_tree_host()->proxy()->MainThreadTaskRunner(); |
987 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); | 977 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); |
988 const CopyOutputRequest& original_request_ref = *original_request; | 978 const CopyOutputRequest& original_request_ref = *original_request; |
(...skipping 22 matching lines...) Expand all Loading... |
1011 | 1001 |
1012 // Reset any state that should be cleared for the next update. | 1002 // Reset any state that should be cleared for the next update. |
1013 stacking_order_changed_ = false; | 1003 stacking_order_changed_ = false; |
1014 update_rect_ = gfx::Rect(); | 1004 update_rect_ = gfx::Rect(); |
1015 | 1005 |
1016 needs_push_properties_ = false; | 1006 needs_push_properties_ = false; |
1017 num_dependents_need_push_properties_ = 0; | 1007 num_dependents_need_push_properties_ = 0; |
1018 } | 1008 } |
1019 | 1009 |
1020 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 1010 scoped_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
1021 return LayerImpl::Create(tree_impl, layer_id_); | 1011 return LayerImpl::Create(tree_impl, layer_id_, |
| 1012 new LayerImpl::SyncedScrollOffset); |
1022 } | 1013 } |
1023 | 1014 |
1024 bool Layer::DrawsContent() const { | 1015 bool Layer::DrawsContent() const { |
1025 return draws_content_; | 1016 return draws_content_; |
1026 } | 1017 } |
1027 | 1018 |
1028 bool Layer::HasDrawableContent() const { | 1019 bool Layer::HasDrawableContent() const { |
1029 return is_drawable_; | 1020 return is_drawable_; |
1030 } | 1021 } |
1031 | 1022 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 | 1095 |
1105 void Layer::ClearRenderSurface() { | 1096 void Layer::ClearRenderSurface() { |
1106 render_surface_ = nullptr; | 1097 render_surface_ = nullptr; |
1107 } | 1098 } |
1108 | 1099 |
1109 void Layer::ClearRenderSurfaceLayerList() { | 1100 void Layer::ClearRenderSurfaceLayerList() { |
1110 if (render_surface_) | 1101 if (render_surface_) |
1111 render_surface_->ClearLayerLists(); | 1102 render_surface_->ClearLayerLists(); |
1112 } | 1103 } |
1113 | 1104 |
1114 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const { | 1105 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() { |
1115 return TotalScrollOffset(); | 1106 return CurrentScrollOffset(); |
1116 } | 1107 } |
1117 | 1108 |
1118 // On<Property>Animated is called due to an ongoing accelerated animation. | 1109 // On<Property>Animated is called due to an ongoing accelerated animation. |
1119 // Since this animation is also being run on the compositor thread, there | 1110 // Since this animation is also being run on the compositor thread, there |
1120 // is no need to request a commit to push this value over, so the value is | 1111 // is no need to request a commit to push this value over, so the value is |
1121 // set directly rather than by calling Set<Property>. | 1112 // set directly rather than by calling Set<Property>. |
1122 void Layer::OnFilterAnimated(const FilterOperations& filters) { | 1113 void Layer::OnFilterAnimated(const FilterOperations& filters) { |
1123 filters_ = filters; | 1114 filters_ = filters; |
1124 } | 1115 } |
1125 | 1116 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 const TransformNode* node = tree.Node(transform_tree_index()); | 1268 const TransformNode* node = tree.Node(transform_tree_index()); |
1278 gfx::Transform ssxform; | 1269 gfx::Transform ssxform; |
1279 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); | 1270 tree.ComputeTransform(node->id, node->data.target_id, &ssxform); |
1280 xform.ConcatTransform(ssxform); | 1271 xform.ConcatTransform(ssxform); |
1281 } | 1272 } |
1282 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); | 1273 xform.Scale(1.0 / contents_scale_x(), 1.0 / contents_scale_y()); |
1283 return xform; | 1274 return xform; |
1284 } | 1275 } |
1285 | 1276 |
1286 } // namespace cc | 1277 } // namespace cc |
OLD | NEW |