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

Side by Side Diff: cc/trees/layer_tree_host_in_process.cc

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_in_process.h" 5 #include "cc/trees/layer_tree_host_in_process.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 info->elastic_overscroll_delta.IsZero() && !info->top_controls_delta) 843 info->elastic_overscroll_delta.IsZero() && !info->top_controls_delta)
844 return; 844 return;
845 845
846 // Preemptively apply the scroll offset and scale delta here before sending 846 // Preemptively apply the scroll offset and scale delta here before sending
847 // it to the client. If the client comes back and sets it to the same 847 // it to the client. If the client comes back and sets it to the same
848 // value, then the layer can early out without needing a full commit. 848 // value, then the layer can early out without needing a full commit.
849 if (layer_tree_->inner_viewport_scroll_layer()) { 849 if (layer_tree_->inner_viewport_scroll_layer()) {
850 layer_tree_->inner_viewport_scroll_layer()->SetScrollOffsetFromImplSide( 850 layer_tree_->inner_viewport_scroll_layer()->SetScrollOffsetFromImplSide(
851 gfx::ScrollOffsetWithDelta( 851 gfx::ScrollOffsetWithDelta(
852 layer_tree_->inner_viewport_scroll_layer()->scroll_offset(), 852 layer_tree_->inner_viewport_scroll_layer()->scroll_offset(),
853 inner_viewport_scroll_delta)); 853 inner_viewport_scroll_delta),
854 nullptr);
854 } 855 }
855 856
856 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); 857 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta);
857 layer_tree_->SetElasticOverscrollFromImplSide( 858 layer_tree_->SetElasticOverscrollFromImplSide(
858 layer_tree_->elastic_overscroll() + info->elastic_overscroll_delta); 859 layer_tree_->elastic_overscroll() + info->elastic_overscroll_delta);
859 // TODO(ccameron): pass the elastic overscroll here so that input events 860 // TODO(ccameron): pass the elastic overscroll here so that input events
860 // may be translated appropriately. 861 // may be translated appropriately.
861 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), 862 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(),
862 info->elastic_overscroll_delta, 863 info->elastic_overscroll_delta,
863 info->page_scale_delta, 864 info->page_scale_delta,
864 info->top_controls_delta); 865 info->top_controls_delta);
865 SetNeedsUpdateLayers(); 866 SetNeedsUpdateLayers();
866 } 867 }
867 868
868 void LayerTreeHostInProcess::ApplyScrollAndScale(ScrollAndScaleSet* info) { 869 void LayerTreeHostInProcess::ApplyScrollAndScale(ScrollAndScaleSet* info) {
869 for (auto& swap_promise : info->swap_promises) { 870 for (auto& swap_promise : info->swap_promises) {
870 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", 871 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow",
871 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), 872 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()),
872 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, 873 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
873 "step", "Main thread scroll update"); 874 "step", "Main thread scroll update");
874 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); 875 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise));
875 } 876 }
876 877
877 if (layer_tree_->root_layer()) { 878 if (layer_tree_->root_layer()) {
878 for (size_t i = 0; i < info->scrolls.size(); ++i) { 879 for (size_t i = 0; i < info->scrolls.size(); ++i) {
879 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); 880 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id);
880 if (!layer) 881 if (!layer)
881 continue; 882 continue;
882 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( 883 layer->SetScrollOffsetFromImplSide(
883 layer->scroll_offset(), info->scrolls[i].scroll_delta)); 884 gfx::ScrollOffsetWithDelta(layer->scroll_offset(),
885 info->scrolls[i].scroll_delta),
886 &info->elastic_overscroll_delta);
884 SetNeedsUpdateLayers(); 887 SetNeedsUpdateLayers();
885 } 888 }
886 } 889 }
887 890
888 // This needs to happen after scroll deltas have been sent to prevent top 891 // This needs to happen after scroll deltas have been sent to prevent top
889 // controls from clamping the layout viewport both on the compositor and 892 // controls from clamping the layout viewport both on the compositor and
890 // on the main thread. 893 // on the main thread.
891 ApplyViewportDeltas(info); 894 ApplyViewportDeltas(info);
892 } 895 }
893 896
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1041
1039 debug_state_.FromProtobuf(proto.debug_state()); 1042 debug_state_.FromProtobuf(proto.debug_state());
1040 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); 1043 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger();
1041 content_is_suitable_for_gpu_rasterization_ = 1044 content_is_suitable_for_gpu_rasterization_ =
1042 proto.content_is_suitable_for_gpu_rasterization(); 1045 proto.content_is_suitable_for_gpu_rasterization();
1043 id_ = proto.id(); 1046 id_ = proto.id();
1044 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); 1047 next_commit_forces_redraw_ = proto.next_commit_forces_redraw();
1045 } 1048 }
1046 1049
1047 } // namespace cc 1050 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698