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

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

Issue 2194833002: Overscroll and Elasticity for views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-RouteThroughInputHandler
Patch Set: Restore functionality and fix bugs \o/ Created 4 years, 1 month 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 info->elastic_overscroll_delta.IsZero() && !info->top_controls_delta) 833 info->elastic_overscroll_delta.IsZero() && !info->top_controls_delta)
834 return; 834 return;
835 835
836 // Preemptively apply the scroll offset and scale delta here before sending 836 // Preemptively apply the scroll offset and scale delta here before sending
837 // it to the client. If the client comes back and sets it to the same 837 // it to the client. If the client comes back and sets it to the same
838 // value, then the layer can early out without needing a full commit. 838 // value, then the layer can early out without needing a full commit.
839 if (layer_tree_->inner_viewport_scroll_layer()) { 839 if (layer_tree_->inner_viewport_scroll_layer()) {
840 layer_tree_->inner_viewport_scroll_layer()->SetScrollOffsetFromImplSide( 840 layer_tree_->inner_viewport_scroll_layer()->SetScrollOffsetFromImplSide(
841 gfx::ScrollOffsetWithDelta( 841 gfx::ScrollOffsetWithDelta(
842 layer_tree_->inner_viewport_scroll_layer()->scroll_offset(), 842 layer_tree_->inner_viewport_scroll_layer()->scroll_offset(),
843 inner_viewport_scroll_delta)); 843 inner_viewport_scroll_delta),
844 nullptr);
844 } 845 }
845 846
846 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); 847 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta);
847 layer_tree_->SetElasticOverscrollFromImplSide( 848 layer_tree_->SetElasticOverscrollFromImplSide(
848 layer_tree_->elastic_overscroll() + info->elastic_overscroll_delta); 849 layer_tree_->elastic_overscroll() + info->elastic_overscroll_delta);
849 // TODO(ccameron): pass the elastic overscroll here so that input events 850 // TODO(ccameron): pass the elastic overscroll here so that input events
850 // may be translated appropriately. 851 // may be translated appropriately.
851 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), 852 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(),
852 info->elastic_overscroll_delta, 853 info->elastic_overscroll_delta,
853 info->page_scale_delta, 854 info->page_scale_delta,
854 info->top_controls_delta); 855 info->top_controls_delta);
855 SetNeedsUpdateLayers(); 856 SetNeedsUpdateLayers();
856 } 857 }
857 858
858 void LayerTreeHostInProcess::ApplyScrollAndScale(ScrollAndScaleSet* info) { 859 void LayerTreeHostInProcess::ApplyScrollAndScale(ScrollAndScaleSet* info) {
859 for (auto& swap_promise : info->swap_promises) { 860 for (auto& swap_promise : info->swap_promises) {
860 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", 861 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow",
861 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), 862 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()),
862 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, 863 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
863 "step", "Main thread scroll update"); 864 "step", "Main thread scroll update");
864 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); 865 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise));
865 } 866 }
866 867
867 if (layer_tree_->root_layer()) { 868 if (layer_tree_->root_layer()) {
868 for (size_t i = 0; i < info->scrolls.size(); ++i) { 869 for (size_t i = 0; i < info->scrolls.size(); ++i) {
869 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id); 870 Layer* layer = layer_tree_->LayerById(info->scrolls[i].layer_id);
870 if (!layer) 871 if (!layer)
871 continue; 872 continue;
872 layer->SetScrollOffsetFromImplSide(gfx::ScrollOffsetWithDelta( 873 layer->SetScrollOffsetFromImplSide(
873 layer->scroll_offset(), info->scrolls[i].scroll_delta)); 874 gfx::ScrollOffsetWithDelta(layer->scroll_offset(),
875 info->scrolls[i].scroll_delta),
876 &info->elastic_overscroll_delta);
874 SetNeedsUpdateLayers(); 877 SetNeedsUpdateLayers();
875 } 878 }
876 } 879 }
877 880
878 // This needs to happen after scroll deltas have been sent to prevent top 881 // This needs to happen after scroll deltas have been sent to prevent top
879 // controls from clamping the layout viewport both on the compositor and 882 // controls from clamping the layout viewport both on the compositor and
880 // on the main thread. 883 // on the main thread.
881 ApplyViewportDeltas(info); 884 ApplyViewportDeltas(info);
882 } 885 }
883 886
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1031
1029 debug_state_.FromProtobuf(proto.debug_state()); 1032 debug_state_.FromProtobuf(proto.debug_state());
1030 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); 1033 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger();
1031 content_is_suitable_for_gpu_rasterization_ = 1034 content_is_suitable_for_gpu_rasterization_ =
1032 proto.content_is_suitable_for_gpu_rasterization(); 1035 proto.content_is_suitable_for_gpu_rasterization();
1033 id_ = proto.id(); 1036 id_ = proto.id();
1034 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); 1037 next_commit_forces_redraw_ = proto.next_commit_forces_redraw();
1035 } 1038 }
1036 1039
1037 } // namespace cc 1040 } // 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