Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: cc/layers/layer.cc

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_ = nullptr; 653 clip_children_ = nullptr;
654 SetNeedsCommit(); 654 SetNeedsCommit();
655 } 655 }
656 656
657 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { 657 void Layer::SetScrollOffset(const gfx::ScrollOffset& 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(
667 const gfx::ScrollOffset& scroll_offset) {
667 DCHECK(IsPropertyChangeAllowed()); 668 DCHECK(IsPropertyChangeAllowed());
668 // This function only gets called during a BeginMainFrame, so there 669 // This function only gets called during a BeginMainFrame, so there
669 // is no need to call SetNeedsUpdate here. 670 // is no need to call SetNeedsUpdate here.
670 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); 671 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested());
671 if (scroll_offset_ == scroll_offset) 672 if (scroll_offset_ == scroll_offset)
672 return; 673 return;
673 scroll_offset_ = scroll_offset; 674 scroll_offset_ = scroll_offset;
674 SetNeedsPushProperties(); 675 SetNeedsPushProperties();
675 if (!did_scroll_callback_.is_null()) 676 if (!did_scroll_callback_.is_null())
676 did_scroll_callback_.Run(); 677 did_scroll_callback_.Run();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 layer->SetClipChildren(NULL); 957 layer->SetClipChildren(NULL);
957 } 958 }
958 959
959 // Adjust the scroll delta to be just the scrolls that have happened since 960 // Adjust the scroll delta to be just the scrolls that have happened since
960 // the BeginMainFrame was sent. This happens for impl-side painting 961 // the BeginMainFrame was sent. This happens for impl-side painting
961 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. 962 // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk.
962 if (layer->layer_tree_impl()->settings().impl_side_painting) { 963 if (layer->layer_tree_impl()->settings().impl_side_painting) {
963 layer->SetScrollOffset(scroll_offset_); 964 layer->SetScrollOffset(scroll_offset_);
964 } else { 965 } else {
965 layer->SetScrollOffsetAndDelta( 966 layer->SetScrollOffsetAndDelta(
966 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); 967 scroll_offset_,
967 layer->SetSentScrollDelta(gfx::Vector2d()); 968 layer->ScrollDelta() - layer->sent_scroll_delta());
969 layer->SetSentScrollDelta(gfx::Vector2dF());
968 } 970 }
969 971
970 // Wrap the copy_requests_ in a PostTask to the main thread. 972 // Wrap the copy_requests_ in a PostTask to the main thread.
971 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests; 973 ScopedPtrVector<CopyOutputRequest> main_thread_copy_requests;
972 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin(); 974 for (ScopedPtrVector<CopyOutputRequest>::iterator it = copy_requests_.begin();
973 it != copy_requests_.end(); 975 it != copy_requests_.end();
974 ++it) { 976 ++it) {
975 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = 977 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
976 layer_tree_host()->proxy()->MainThreadTaskRunner(); 978 layer_tree_host()->proxy()->MainThreadTaskRunner();
977 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it); 979 scoped_ptr<CopyOutputRequest> original_request = copy_requests_.take(it);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1088
1087 void Layer::ClearRenderSurface() { 1089 void Layer::ClearRenderSurface() {
1088 draw_properties_.render_surface = nullptr; 1090 draw_properties_.render_surface = nullptr;
1089 } 1091 }
1090 1092
1091 void Layer::ClearRenderSurfaceLayerList() { 1093 void Layer::ClearRenderSurfaceLayerList() {
1092 if (draw_properties_.render_surface) 1094 if (draw_properties_.render_surface)
1093 draw_properties_.render_surface->layer_list().clear(); 1095 draw_properties_.render_surface->layer_list().clear();
1094 } 1096 }
1095 1097
1096 gfx::Vector2dF Layer::ScrollOffsetForAnimation() const { 1098 gfx::ScrollOffset Layer::ScrollOffsetForAnimation() const {
1097 return TotalScrollOffset(); 1099 return TotalScrollOffset();
1098 } 1100 }
1099 1101
1100 // On<Property>Animated is called due to an ongoing accelerated animation. 1102 // On<Property>Animated is called due to an ongoing accelerated animation.
1101 // Since this animation is also being run on the compositor thread, there 1103 // Since this animation is also being run on the compositor thread, there
1102 // is no need to request a commit to push this value over, so the value is 1104 // is no need to request a commit to push this value over, so the value is
1103 // set directly rather than by calling Set<Property>. 1105 // set directly rather than by calling Set<Property>.
1104 void Layer::OnFilterAnimated(const FilterOperations& filters) { 1106 void Layer::OnFilterAnimated(const FilterOperations& filters) {
1105 filters_ = filters; 1107 filters_ = filters;
1106 } 1108 }
1107 1109
1108 void Layer::OnOpacityAnimated(float opacity) { 1110 void Layer::OnOpacityAnimated(float opacity) {
1109 opacity_ = opacity; 1111 opacity_ = opacity;
1110 } 1112 }
1111 1113
1112 void Layer::OnTransformAnimated(const gfx::Transform& transform) { 1114 void Layer::OnTransformAnimated(const gfx::Transform& transform) {
1113 if (transform_ == transform) 1115 if (transform_ == transform)
1114 return; 1116 return;
1115 transform_ = transform; 1117 transform_ = transform;
1116 transform_is_invertible_ = transform.IsInvertible(); 1118 transform_is_invertible_ = transform.IsInvertible();
1117 } 1119 }
1118 1120
1119 void Layer::OnScrollOffsetAnimated(const gfx::Vector2dF& scroll_offset) { 1121 void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
1120 // Do nothing. Scroll deltas will be sent from the compositor thread back 1122 // Do nothing. Scroll deltas will be sent from the compositor thread back
1121 // to the main thread in the same manner as during non-animated 1123 // to the main thread in the same manner as during non-animated
1122 // compositor-driven scrolling. 1124 // compositor-driven scrolling.
1123 } 1125 }
1124 1126
1125 void Layer::OnAnimationWaitingForDeletion() { 1127 void Layer::OnAnimationWaitingForDeletion() {
1126 // Animations are only deleted during PushProperties. 1128 // Animations are only deleted during PushProperties.
1127 SetNeedsPushProperties(); 1129 SetNeedsPushProperties();
1128 } 1130 }
1129 1131
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 1235
1234 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1236 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1235 benchmark->RunOnLayer(this); 1237 benchmark->RunOnLayer(this);
1236 } 1238 }
1237 1239
1238 bool Layer::HasDelegatedContent() const { 1240 bool Layer::HasDelegatedContent() const {
1239 return false; 1241 return false;
1240 } 1242 }
1241 1243
1242 } // namespace cc 1244 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698