Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 bool scroll_on_main_thread = (scroll_thread == MAIN_THREAD); | 149 bool scroll_on_main_thread = (scroll_thread == MAIN_THREAD); |
| 150 if (IsWheelBasedScroll(type)) { | 150 if (IsWheelBasedScroll(type)) { |
| 151 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorWheelScrollUpdateThread", | 151 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorWheelScrollUpdateThread", |
| 152 scroll_on_main_thread); | 152 scroll_on_main_thread); |
| 153 } else { | 153 } else { |
| 154 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread", | 154 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread", |
| 155 scroll_on_main_thread); | 155 scroll_on_main_thread); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Used to cache scroll related variables that get reset while clearing | |
| 160 // the currently scrolling layer. Cached values are restored in case of a | |
| 161 // scrollBegin in inertial phase (fling) to latch the fling to its | |
| 162 // coresponding scroll event. | |
|
tdresser
2016/10/19 15:28:04
corresponding
sahel
2016/10/25 15:34:14
Done.
| |
| 163 class ScrollingVariablesState { | |
| 164 public: | |
| 165 ScrollingVariablesState() { | |
| 166 ScrollingVariablesState(false, false, gfx::Vector2dF()); | |
| 167 } | |
| 168 ScrollingVariablesState(bool did_lock_scrolling_layer, | |
| 169 bool scroll_affects_scroll_handler, | |
| 170 gfx::Vector2dF accumulated_root_overscroll) | |
| 171 : did_lock_scrolling_layer_(did_lock_scrolling_layer), | |
| 172 scroll_affects_scroll_handler_(scroll_affects_scroll_handler), | |
| 173 accumulated_root_overscroll_(accumulated_root_overscroll) {} | |
| 174 | |
| 175 bool didLockScrollingLayer() { return did_lock_scrolling_layer_; } | |
| 176 bool scrollAffectsScrollHandler() { return scroll_affects_scroll_handler_; } | |
| 177 gfx::Vector2dF accumulatedRootOverscroll() { | |
| 178 return accumulated_root_overscroll_; | |
| 179 } | |
| 180 | |
| 181 private: | |
| 182 bool did_lock_scrolling_layer_; | |
| 183 bool scroll_affects_scroll_handler_; | |
| 184 gfx::Vector2dF accumulated_root_overscroll_; | |
| 185 }; | |
| 186 | |
| 187 ScrollingVariablesState CashedScrollingVariablesState; | |
|
tdresser
2016/10/19 15:28:04
Variable name should be cached_scrolling_variables
bokan
2016/10/20 15:35:10
Is there a reason for this variable to be a local
sahel
2016/10/25 15:34:14
Done.
sahel
2016/10/25 15:34:14
Acknowledged.
| |
| 188 | |
| 159 } // namespace | 189 } // namespace |
| 160 | 190 |
| 161 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, | 191 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
| 162 "Scheduling.%s.PendingTreeDuration"); | 192 "Scheduling.%s.PendingTreeDuration"); |
| 163 | 193 |
| 164 LayerTreeHostImpl::FrameData::FrameData() | 194 LayerTreeHostImpl::FrameData::FrameData() |
| 165 : render_surface_layer_list(nullptr), | 195 : render_surface_layer_list(nullptr), |
| 166 has_no_damage(false), | 196 has_no_damage(false), |
| 167 may_contain_video(false) {} | 197 may_contain_video(false) {} |
| 168 | 198 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 active_tree_->property_trees()->is_active = true; | 288 active_tree_->property_trees()->is_active = true; |
| 259 | 289 |
| 260 viewport_ = Viewport::Create(this); | 290 viewport_ = Viewport::Create(this); |
| 261 | 291 |
| 262 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 292 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 263 "cc::LayerTreeHostImpl", id_); | 293 "cc::LayerTreeHostImpl", id_); |
| 264 | 294 |
| 265 top_controls_manager_ = | 295 top_controls_manager_ = |
| 266 TopControlsManager::Create(this, settings.top_controls_show_threshold, | 296 TopControlsManager::Create(this, settings.top_controls_show_threshold, |
| 267 settings.top_controls_hide_threshold); | 297 settings.top_controls_hide_threshold); |
| 298 CashedScrollingVariablesState = ScrollingVariablesState( | |
| 299 did_lock_scrolling_layer_, scroll_affects_scroll_handler_, | |
| 300 accumulated_root_overscroll_); | |
| 268 } | 301 } |
| 269 | 302 |
| 270 LayerTreeHostImpl::~LayerTreeHostImpl() { | 303 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 271 DCHECK(task_runner_provider_->IsImplThread()); | 304 DCHECK(task_runner_provider_->IsImplThread()); |
| 272 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 305 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 273 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 306 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 274 "cc::LayerTreeHostImpl", id_); | 307 "cc::LayerTreeHostImpl", id_); |
| 275 | 308 |
| 276 // It is released before shutdown. | 309 // It is released before shutdown. |
| 277 DCHECK(!compositor_frame_sink_); | 310 DCHECK(!compositor_frame_sink_); |
| (...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2636 return ScrollBeginImpl(scroll_state, viewport()->MainScrollLayer(), type); | 2669 return ScrollBeginImpl(scroll_state, viewport()->MainScrollLayer(), type); |
| 2637 } | 2670 } |
| 2638 | 2671 |
| 2639 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( | 2672 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin( |
| 2640 ScrollState* scroll_state, | 2673 ScrollState* scroll_state, |
| 2641 InputHandler::ScrollInputType type) { | 2674 InputHandler::ScrollInputType type) { |
| 2642 ScrollStatus scroll_status; | 2675 ScrollStatus scroll_status; |
| 2643 scroll_status.main_thread_scrolling_reasons = | 2676 scroll_status.main_thread_scrolling_reasons = |
| 2644 MainThreadScrollingReason::kNotScrollingOnMain; | 2677 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2645 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); | 2678 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin"); |
| 2679 LayerImpl* scrolling_layer_impl = nullptr; | |
| 2680 // On Mac a scroll begin with |inertial_phase| = true happens to handle a | |
| 2681 // fling. Also, touchpad fling starts are handled by calling ScrollBegin | |
| 2682 // instead of FlingScrollBegin. | |
| 2683 if (scroll_state->is_in_inertial_phase()) { | |
| 2684 scrolling_layer_impl = | |
| 2685 active_tree_->LayerById(active_tree_->LastScrolledLayerId()); | |
| 2686 RestoreCachedScrollingVariablesState(); | |
| 2687 } | |
| 2646 | 2688 |
| 2647 // On Mac a scroll begin with |inertial_phase| = true happens to handle a | 2689 if (!scrolling_layer_impl) { |
| 2648 // fling. | 2690 ClearCurrentlyScrollingLayer(); |
| 2649 if (scroll_state->is_in_inertial_phase()) | |
| 2650 return FlingScrollBegin(); | |
| 2651 | 2691 |
| 2652 ClearCurrentlyScrollingLayer(); | 2692 gfx::Point viewport_point(scroll_state->position_x(), |
| 2693 scroll_state->position_y()); | |
| 2653 | 2694 |
| 2654 gfx::Point viewport_point(scroll_state->position_x(), | 2695 gfx::PointF device_viewport_point = gfx::ScalePoint( |
| 2655 scroll_state->position_y()); | 2696 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
| 2697 LayerImpl* layer_impl = | |
| 2698 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | |
| 2656 | 2699 |
| 2657 gfx::PointF device_viewport_point = gfx::ScalePoint( | 2700 if (layer_impl) { |
| 2658 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 2701 LayerImpl* scroll_layer_impl = |
| 2659 LayerImpl* layer_impl = | 2702 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( |
| 2660 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 2703 device_viewport_point); |
| 2704 if (scroll_layer_impl && | |
| 2705 !HasScrollAncestor(layer_impl, scroll_layer_impl)) { | |
| 2706 scroll_status.thread = SCROLL_UNKNOWN; | |
| 2707 scroll_status.main_thread_scrolling_reasons = | |
| 2708 MainThreadScrollingReason::kFailedHitTest; | |
| 2709 return scroll_status; | |
| 2710 } | |
| 2711 } | |
| 2661 | 2712 |
| 2662 if (layer_impl) { | 2713 bool scroll_on_main_thread = false; |
| 2663 LayerImpl* scroll_layer_impl = | 2714 scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint( |
| 2664 active_tree_->FindFirstScrollingLayerOrScrollbarLayerThatIsHitByPoint( | 2715 device_viewport_point, type, layer_impl, &scroll_on_main_thread, |
| 2665 device_viewport_point); | 2716 &scroll_status.main_thread_scrolling_reasons); |
| 2666 if (scroll_layer_impl && | 2717 |
| 2667 !HasScrollAncestor(layer_impl, scroll_layer_impl)) { | 2718 if (scrolling_layer_impl) |
| 2668 scroll_status.thread = SCROLL_UNKNOWN; | 2719 scroll_affects_scroll_handler_ = |
| 2669 scroll_status.main_thread_scrolling_reasons = | 2720 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers(); |
| 2670 MainThreadScrollingReason::kFailedHitTest; | 2721 |
| 2722 if (scroll_on_main_thread) { | |
| 2723 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); | |
| 2724 | |
| 2725 scroll_status.thread = SCROLL_ON_MAIN_THREAD; | |
| 2671 return scroll_status; | 2726 return scroll_status; |
| 2672 } | 2727 } |
| 2673 } | 2728 } |
| 2674 | 2729 |
| 2675 bool scroll_on_main_thread = false; | |
| 2676 LayerImpl* scrolling_layer_impl = FindScrollLayerForDeviceViewportPoint( | |
| 2677 device_viewport_point, type, layer_impl, &scroll_on_main_thread, | |
| 2678 &scroll_status.main_thread_scrolling_reasons); | |
| 2679 | |
| 2680 if (scrolling_layer_impl) | |
| 2681 scroll_affects_scroll_handler_ = | |
| 2682 scrolling_layer_impl->layer_tree_impl()->have_scroll_event_handlers(); | |
| 2683 | |
| 2684 if (scroll_on_main_thread) { | |
| 2685 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); | |
| 2686 | |
| 2687 scroll_status.thread = SCROLL_ON_MAIN_THREAD; | |
| 2688 return scroll_status; | |
| 2689 } | |
| 2690 | |
| 2691 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); | 2730 return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type); |
| 2692 } | 2731 } |
| 2693 | 2732 |
| 2694 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimatedBegin( | 2733 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimatedBegin( |
| 2695 const gfx::Point& viewport_point) { | 2734 const gfx::Point& viewport_point) { |
| 2696 InputHandler::ScrollStatus scroll_status; | 2735 InputHandler::ScrollStatus scroll_status; |
| 2697 scroll_status.main_thread_scrolling_reasons = | 2736 scroll_status.main_thread_scrolling_reasons = |
| 2698 MainThreadScrollingReason::kNotScrollingOnMain; | 2737 MainThreadScrollingReason::kNotScrollingOnMain; |
| 2699 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 2738 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 2700 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2739 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2718 // ScrollAnimated is used for animated wheel scrolls. We find the first layer | 2757 // ScrollAnimated is used for animated wheel scrolls. We find the first layer |
| 2719 // that can scroll and set up an animation of its scroll offset. Note that | 2758 // that can scroll and set up an animation of its scroll offset. Note that |
| 2720 // this does not currently go through the scroll customization machinery | 2759 // this does not currently go through the scroll customization machinery |
| 2721 // that ScrollBy uses for non-animated wheel scrolls. | 2760 // that ScrollBy uses for non-animated wheel scrolls. |
| 2722 scroll_status = ScrollBegin(&scroll_state, WHEEL); | 2761 scroll_status = ScrollBegin(&scroll_state, WHEEL); |
| 2723 scroll_node = scroll_tree.CurrentlyScrollingNode(); | 2762 scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 2724 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { | 2763 if (scroll_status.thread == SCROLL_ON_IMPL_THREAD) { |
| 2725 ScrollStateData scroll_state_end_data; | 2764 ScrollStateData scroll_state_end_data; |
| 2726 scroll_state_end_data.is_ending = true; | 2765 scroll_state_end_data.is_ending = true; |
| 2727 ScrollState scroll_state_end(scroll_state_end_data); | 2766 ScrollState scroll_state_end(scroll_state_end_data); |
| 2728 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is | |
| 2729 // implemented, the current scrolling layer should not get cleared after | |
| 2730 // each animation (crbug.com/526463). | |
| 2731 ScrollEnd(&scroll_state_end); | 2767 ScrollEnd(&scroll_state_end); |
| 2732 ClearCurrentlyScrollingLayer(); | |
| 2733 } | 2768 } |
| 2734 return scroll_status; | 2769 return scroll_status; |
| 2735 } | 2770 } |
| 2736 | 2771 |
| 2737 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta( | 2772 gfx::Vector2dF LayerTreeHostImpl::ComputeScrollDelta( |
| 2738 ScrollNode* scroll_node, | 2773 ScrollNode* scroll_node, |
| 2739 const gfx::Vector2dF& delta) { | 2774 const gfx::Vector2dF& delta) { |
| 2740 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree; | 2775 ScrollTree& scroll_tree = active_tree()->property_trees()->scroll_tree; |
| 2741 float scale_factor = active_tree()->current_page_scale_factor(); | 2776 float scale_factor = active_tree()->current_page_scale_factor(); |
| 2742 | 2777 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2847 gfx::Vector2dF scroll_delta = | 2882 gfx::Vector2dF scroll_delta = |
| 2848 ComputeScrollDelta(scroll_node, pending_delta); | 2883 ComputeScrollDelta(scroll_node, pending_delta); |
| 2849 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) | 2884 if (ScrollAnimationCreate(scroll_node, scroll_delta, delayed_by)) |
| 2850 return scroll_status; | 2885 return scroll_status; |
| 2851 | 2886 |
| 2852 pending_delta -= scroll_delta; | 2887 pending_delta -= scroll_delta; |
| 2853 } | 2888 } |
| 2854 } | 2889 } |
| 2855 } | 2890 } |
| 2856 scroll_state.set_is_ending(true); | 2891 scroll_state.set_is_ending(true); |
| 2857 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is | |
| 2858 // implemented, the current scrolling layer should not get cleared after | |
| 2859 // each animation (crbug.com/526463). | |
| 2860 ScrollEnd(&scroll_state); | 2892 ScrollEnd(&scroll_state); |
| 2861 ClearCurrentlyScrollingLayer(); | |
| 2862 | 2893 |
| 2863 return scroll_status; | 2894 return scroll_status; |
| 2864 } | 2895 } |
| 2865 | 2896 |
| 2866 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( | 2897 gfx::Vector2dF LayerTreeHostImpl::ScrollNodeWithViewportSpaceDelta( |
| 2867 ScrollNode* scroll_node, | 2898 ScrollNode* scroll_node, |
| 2868 const gfx::PointF& viewport_point, | 2899 const gfx::PointF& viewport_point, |
| 2869 const gfx::Vector2dF& viewport_delta, | 2900 const gfx::Vector2dF& viewport_delta, |
| 2870 ScrollTree* scroll_tree) { | 2901 ScrollTree* scroll_tree) { |
| 2871 // Layers with non-invertible screen space transforms should not have passed | 2902 // Layers with non-invertible screen space transforms should not have passed |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3159 client_->SetNeedsCommitOnImplThread(); | 3190 client_->SetNeedsCommitOnImplThread(); |
| 3160 // After applying the synchronous input handler's scroll offset, tell it what | 3191 // After applying the synchronous input handler's scroll offset, tell it what |
| 3161 // we ended up with. | 3192 // we ended up with. |
| 3162 UpdateRootLayerStateForSynchronousInputHandler(); | 3193 UpdateRootLayerStateForSynchronousInputHandler(); |
| 3163 SetFullViewportDamage(); | 3194 SetFullViewportDamage(); |
| 3164 SetNeedsRedraw(); | 3195 SetNeedsRedraw(); |
| 3165 } | 3196 } |
| 3166 | 3197 |
| 3167 void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() { | 3198 void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() { |
| 3168 active_tree_->ClearCurrentlyScrollingLayer(); | 3199 active_tree_->ClearCurrentlyScrollingLayer(); |
| 3200 // Cached scrolling variables state is restored in a ScrollBegin with | |
| 3201 // inertial phase (fling) to latch it to its corresponding scroll. When | |
| 3202 // reseting a variable here, update ScrollingVariablesState struct as well | |
| 3203 // to maintain the proper caching. | |
| 3204 CacheScrollingVariablesState(); | |
| 3169 did_lock_scrolling_layer_ = false; | 3205 did_lock_scrolling_layer_ = false; |
| 3170 scroll_affects_scroll_handler_ = false; | 3206 scroll_affects_scroll_handler_ = false; |
| 3171 accumulated_root_overscroll_ = gfx::Vector2dF(); | 3207 accumulated_root_overscroll_ = gfx::Vector2dF(); |
| 3172 } | 3208 } |
| 3173 | 3209 |
| 3174 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { | 3210 void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) { |
| 3175 DCHECK(scroll_state); | 3211 DCHECK(scroll_state); |
| 3176 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 3212 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| 3177 | 3213 |
| 3178 DistributeScrollDelta(scroll_state); | 3214 DistributeScrollDelta(scroll_state); |
| 3179 top_controls_manager_->ScrollEnd(); | 3215 top_controls_manager_->ScrollEnd(); |
| 3180 | 3216 |
| 3181 if (scroll_state->is_in_inertial_phase()) { | 3217 ClearCurrentlyScrollingLayer(); |
| 3182 // Only clear the currently scrolling layer if we know the scroll is done. | |
| 3183 // A non-inertial scroll end could be followed by an inertial scroll. | |
| 3184 ClearCurrentlyScrollingLayer(); | |
| 3185 } | |
| 3186 } | 3218 } |
| 3187 | 3219 |
| 3188 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { | 3220 InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() { |
| 3189 InputHandler::ScrollStatus scroll_status; | 3221 InputHandler::ScrollStatus scroll_status; |
| 3190 scroll_status.main_thread_scrolling_reasons = | 3222 scroll_status.main_thread_scrolling_reasons = |
| 3191 MainThreadScrollingReason::kNotScrollingOnMain; | 3223 MainThreadScrollingReason::kNotScrollingOnMain; |
| 3192 if (!CurrentlyScrollingLayer()) { | 3224 if (!CurrentlyScrollingLayer()) { |
| 3193 scroll_status.thread = SCROLL_IGNORED; | 3225 scroll_status.thread = SCROLL_IGNORED; |
| 3194 scroll_status.main_thread_scrolling_reasons = | 3226 scroll_status.main_thread_scrolling_reasons = |
| 3195 MainThreadScrollingReason::kNoScrollingLayer; | 3227 MainThreadScrollingReason::kNoScrollingLayer; |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4015 return; | 4047 return; |
| 4016 LayerImpl* layer = tree->LayerByElementId(element_id); | 4048 LayerImpl* layer = tree->LayerByElementId(element_id); |
| 4017 if (layer) | 4049 if (layer) |
| 4018 layer->OnIsAnimatingChanged(mask, state); | 4050 layer->OnIsAnimatingChanged(mask, state); |
| 4019 } | 4051 } |
| 4020 | 4052 |
| 4021 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { | 4053 void LayerTreeHostImpl::ScrollOffsetAnimationFinished() { |
| 4022 // TODO(majidvp): We should pass in the original starting scroll position here | 4054 // TODO(majidvp): We should pass in the original starting scroll position here |
| 4023 ScrollStateData scroll_state_data; | 4055 ScrollStateData scroll_state_data; |
| 4024 ScrollState scroll_state(scroll_state_data); | 4056 ScrollState scroll_state(scroll_state_data); |
| 4025 // TODO(Sahel): Once the touchpad scroll latching for Non-mac devices is | |
| 4026 // implemented, the current scrolling layer should not get cleared after | |
| 4027 // each animation (crbug.com/526463). | |
| 4028 ScrollEnd(&scroll_state); | 4057 ScrollEnd(&scroll_state); |
| 4029 ClearCurrentlyScrollingLayer(); | |
| 4030 } | 4058 } |
| 4031 | 4059 |
| 4032 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( | 4060 gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation( |
| 4033 ElementId element_id) const { | 4061 ElementId element_id) const { |
| 4034 if (active_tree()) { | 4062 if (active_tree()) { |
| 4035 LayerImpl* layer = active_tree()->LayerByElementId(element_id); | 4063 LayerImpl* layer = active_tree()->LayerByElementId(element_id); |
| 4036 if (layer) | 4064 if (layer) |
| 4037 return layer->ScrollOffsetForAnimation(); | 4065 return layer->ScrollOffsetForAnimation(); |
| 4038 } | 4066 } |
| 4039 | 4067 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4087 ContextProvider::ScopedContextLock hold(worker_context); | 4115 ContextProvider::ScopedContextLock hold(worker_context); |
| 4088 if (is_visible) { | 4116 if (is_visible) { |
| 4089 worker_context_visibility_ = | 4117 worker_context_visibility_ = |
| 4090 worker_context->CacheController()->ClientBecameVisible(); | 4118 worker_context->CacheController()->ClientBecameVisible(); |
| 4091 } else { | 4119 } else { |
| 4092 worker_context->CacheController()->ClientBecameNotVisible( | 4120 worker_context->CacheController()->ClientBecameNotVisible( |
| 4093 std::move(worker_context_visibility_)); | 4121 std::move(worker_context_visibility_)); |
| 4094 } | 4122 } |
| 4095 } | 4123 } |
| 4096 | 4124 |
| 4125 void LayerTreeHostImpl::CacheScrollingVariablesState() { | |
| 4126 CashedScrollingVariablesState = ScrollingVariablesState( | |
| 4127 did_lock_scrolling_layer_, scroll_affects_scroll_handler_, | |
| 4128 accumulated_root_overscroll_); | |
| 4129 } | |
| 4130 void LayerTreeHostImpl::RestoreCachedScrollingVariablesState() { | |
| 4131 did_lock_scrolling_layer_ = | |
| 4132 CashedScrollingVariablesState.didLockScrollingLayer(); | |
| 4133 scroll_affects_scroll_handler_ = | |
| 4134 CashedScrollingVariablesState.scrollAffectsScrollHandler(); | |
| 4135 accumulated_root_overscroll_ = | |
| 4136 CashedScrollingVariablesState.accumulatedRootOverscroll(); | |
| 4137 } | |
| 4138 | |
| 4097 } // namespace cc | 4139 } // namespace cc |
| OLD | NEW |