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

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

Issue 2290233004: currentlyscrollinglayer cleared in scrollAnimatedBegin. (Closed)
Patch Set: nit fixed. Created 4 years, 3 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 | « no previous file | cc/trees/layer_tree_host_impl_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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.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 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 } else { 2781 } else {
2782 scroll_status.thread = SCROLL_IGNORED; 2782 scroll_status.thread = SCROLL_IGNORED;
2783 scroll_status.main_thread_scrolling_reasons = 2783 scroll_status.main_thread_scrolling_reasons =
2784 MainThreadScrollingReason::kNotScrollable; 2784 MainThreadScrollingReason::kNotScrollable;
2785 } 2785 }
2786 return scroll_status; 2786 return scroll_status;
2787 } 2787 }
2788 ScrollStateData scroll_state_data; 2788 ScrollStateData scroll_state_data;
2789 scroll_state_data.position_x = viewport_point.x(); 2789 scroll_state_data.position_x = viewport_point.x();
2790 scroll_state_data.position_y = viewport_point.y(); 2790 scroll_state_data.position_y = viewport_point.y();
2791 scroll_state_data.is_in_inertial_phase = true;
2792 ScrollState scroll_state(scroll_state_data); 2791 ScrollState scroll_state(scroll_state_data);
2793 2792
2794 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2793 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2795 // that can scroll and set up an animation of its scroll offset. Note that 2794 // that can scroll and set up an animation of its scroll offset. Note that
2796 // this does not currently go through the scroll customization machinery 2795 // this does not currently go through the scroll customization machinery
2797 // that ScrollBy uses for non-animated wheel scrolls. 2796 // that ScrollBy uses for non-animated wheel scrolls.
2798 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2797 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2799 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2798 scroll_node = scroll_tree.CurrentlyScrollingNode();
2800 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2799 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2801 ScrollStateData scroll_state_end_data; 2800 ScrollStateData scroll_state_end_data;
2802 scroll_state_end_data.is_ending = true; 2801 scroll_state_end_data.is_ending = true;
2803 ScrollState scroll_state_end(scroll_state_end_data); 2802 ScrollState scroll_state_end(scroll_state_end_data);
2803 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2804 // implemented, the current scrolling layer should not get cleared after
2805 // each animation (crbug.com/526463).
2804 ScrollEnd(&scroll_state_end); 2806 ScrollEnd(&scroll_state_end);
2807 ClearCurrentlyScrollingLayer();
2805 } 2808 }
2806 return scroll_status; 2809 return scroll_status;
2807 } 2810 }
2808 2811
2809 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta( 2812 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta(
2810 ScrollNode* scroll_node, 2813 ScrollNode* scroll_node,
2811 const gfx::Vector2dF& delta) { 2814 const gfx::Vector2dF& delta) {
2812 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree; 2815 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree;
2813 float scale_factor = active_tree()->current_page_scale_factor(); 2816 float scale_factor = active_tree()->current_page_scale_factor();
2814 2817
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2879 scroll_status.thread = SCROLL_IGNORED; 2882 scroll_status.thread = SCROLL_IGNORED;
2880 scroll_status.main_thread_scrolling_reasons = 2883 scroll_status.main_thread_scrolling_reasons =
2881 MainThreadScrollingReason::kNotScrollable; 2884 MainThreadScrollingReason::kNotScrollable;
2882 } 2885 }
2883 return scroll_status; 2886 return scroll_status;
2884 } 2887 }
2885 2888
2886 ScrollStateData scroll_state_data; 2889 ScrollStateData scroll_state_data;
2887 scroll_state_data.position_x = viewport_point.x(); 2890 scroll_state_data.position_x = viewport_point.x();
2888 scroll_state_data.position_y = viewport_point.y(); 2891 scroll_state_data.position_y = viewport_point.y();
2889 scroll_state_data.is_in_inertial_phase = false;
2890 ScrollState scroll_state(scroll_state_data); 2892 ScrollState scroll_state(scroll_state_data);
2891 2893
2892 // ScrollAnimated is used for animated wheel scrolls. We find the first layer 2894 // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2893 // that can scroll and set up an animation of its scroll offset. Note that 2895 // that can scroll and set up an animation of its scroll offset. Note that
2894 // this does not currently go through the scroll customization machinery 2896 // this does not currently go through the scroll customization machinery
2895 // that ScrollBy uses for non-animated wheel scrolls. 2897 // that ScrollBy uses for non-animated wheel scrolls.
2896 scroll_status = ScrollBegin(&scroll_state, WHEEL); 2898 scroll_status = ScrollBegin(&scroll_state, WHEEL);
2897 scroll_node = scroll_tree.CurrentlyScrollingNode(); 2899 scroll_node = scroll_tree.CurrentlyScrollingNode();
2898 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { 2900 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) {
2899 gfx::Vector2dF pending_delta = scroll_delta; 2901 gfx::Vector2dF pending_delta = scroll_delta;
(...skipping 18 matching lines...) Expand all
2918 ComputeScrollDelta(scroll_node, pending_delta); 2920 ComputeScrollDelta(scroll_node, pending_delta);
2919 if (ScrollAnimationCreate(scroll_node, scroll_delta)) 2921 if (ScrollAnimationCreate(scroll_node, scroll_delta))
2920 return scroll_status; 2922 return scroll_status;
2921 2923
2922 pending_delta -= scroll_delta; 2924 pending_delta -= scroll_delta;
2923 } 2925 }
2924 } 2926 }
2925 } 2927 }
2926 scroll_state.set_is_ending(true); 2928 scroll_state.set_is_ending(true);
2927 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is 2929 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
2928 // impelemented, the current scrolling layer should not get cleared after 2930 // implemented, the current scrolling layer should not get cleared after
2929 // each animation (crbug.com/526463). 2931 // each animation (crbug.com/526463).
2930 ScrollEnd(&scroll_state); 2932 ScrollEnd(&scroll_state);
2931 ClearCurrentlyScrollingLayer(); 2933 ClearCurrentlyScrollingLayer();
2932 2934
2933 return scroll_status; 2935 return scroll_status;
2934 } 2936 }
2935 2937
2936 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( 2938 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta(
2937 ScrollNode* scroll_node, 2939 ScrollNode* scroll_node,
2938 const gfx::PointF& viewport_point, 2940 const gfx::PointF& viewport_point,
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
4159 break; 4161 break;
4160 } 4162 }
4161 } 4163 }
4162 } 4164 }
4163 4165
4164 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { 4166 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
4165 // TODO(majidvp): We should pass in the original starting scroll position here 4167 // TODO(majidvp): We should pass in the original starting scroll position here
4166 ScrollStateData scroll_state_data; 4168 ScrollStateData scroll_state_data;
4167 ScrollState scroll_state(scroll_state_data); 4169 ScrollState scroll_state(scroll_state_data);
4168 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is 4170 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is
4169 // impelemented, the current scrolling layer should not get cleared after 4171 // implemented, the current scrolling layer should not get cleared after
4170 // each animation (crbug.com/526463). 4172 // each animation (crbug.com/526463).
4171 ScrollEnd(&scroll_state); 4173 ScrollEnd(&scroll_state);
4172 ClearCurrentlyScrollingLayer(); 4174 ClearCurrentlyScrollingLayer();
4173 } 4175 }
4174 4176
4175 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( 4177 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
4176 ElementId element_id) const { 4178 ElementId element_id) const {
4177 if (active_tree()) { 4179 if (active_tree()) {
4178 LayerImpl* layer = active_tree()->LayerByElementId(element_id); 4180 LayerImpl* layer = active_tree()->LayerByElementId(element_id);
4179 if (layer) 4181 if (layer)
4180 return layer->ScrollOffsetForAnimation(); 4182 return layer->ScrollOffsetForAnimation();
4181 } 4183 }
4182 4184
4183 return gfx::ScrollOffset(); 4185 return gfx::ScrollOffset();
4184 } 4186 }
4185 4187
4186 bool LayerTreeHostImpl::SupportsImplScrolling() const { 4188 bool LayerTreeHostImpl::SupportsImplScrolling() const {
4187 // Supported in threaded mode. 4189 // Supported in threaded mode.
4188 return task_runner_provider_->HasImplThread(); 4190 return task_runner_provider_->HasImplThread();
4189 } 4191 }
4190 4192
4191 bool LayerTreeHostImpl::CommitToActiveTree() const { 4193 bool LayerTreeHostImpl::CommitToActiveTree() const {
4192 // In single threaded mode we skip the pending tree and commit directly to the 4194 // In single threaded mode we skip the pending tree and commit directly to the
4193 // active tree. 4195 // active tree.
4194 return !task_runner_provider_->HasImplThread(); 4196 return !task_runner_provider_->HasImplThread();
4195 } 4197 }
4196 4198
4197 } // namespace cc 4199 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698