Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.h |
| diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h |
| index e0539a66a9795e96a95a458d82c763cae76d963e..572a73141e7174b85d7b6fc4f2ae50645fab182b 100644 |
| --- a/cc/trees/layer_tree_host_impl.h |
| +++ b/cc/trees/layer_tree_host_impl.h |
| @@ -131,6 +131,40 @@ class LayerTreeHostImplClient { |
| virtual ~LayerTreeHostImplClient() {} |
| }; |
| +// Used to cache scroll related variables that get reset while clearing |
| +// the currently scrolling layer. Cached values are restored in case of a |
| +// scrollBegin in inertial phase (fling) to latch the fling to the previously |
| +// scrolling layer. |
| +class ScrollStateForFling { |
|
aelias_OOO_until_Jul13
2016/10/27 21:48:11
What's the event sequence that makes this needed?
sahel
2016/10/27 22:57:06
Yes, that's the even sequence and it only happens
|
| + public: |
| + ScrollStateForFling() { |
| + ScrollStateForFling(Layer::INVALID_ID, false, false, gfx::Vector2dF()); |
| + } |
| + ScrollStateForFling(int scrolling_layer_id, |
| + bool did_lock_scrolling_layer, |
| + bool scroll_affects_scroll_handler, |
| + gfx::Vector2dF accumulated_root_overscroll) |
| + : scrolling_layer_id_(scrolling_layer_id), |
| + did_lock_scrolling_layer_(did_lock_scrolling_layer), |
| + scroll_affects_scroll_handler_(scroll_affects_scroll_handler), |
| + accumulated_root_overscroll_(accumulated_root_overscroll) {} |
| + |
| + int scrolling_layer_id() { return scrolling_layer_id_; } |
| + bool did_lock_scrolling_layer() { return did_lock_scrolling_layer_; } |
| + bool scroll_affects_scroll_handler() { |
| + return scroll_affects_scroll_handler_; |
| + } |
| + gfx::Vector2dF accumulated_root_overscroll() { |
| + return accumulated_root_overscroll_; |
| + } |
| + |
| + private: |
| + int scrolling_layer_id_; |
| + bool did_lock_scrolling_layer_; |
| + bool scroll_affects_scroll_handler_; |
| + gfx::Vector2dF accumulated_root_overscroll_; |
| +}; |
| + |
| // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| // state. |
| class CC_EXPORT LayerTreeHostImpl |
| @@ -696,6 +730,13 @@ class CC_EXPORT LayerTreeHostImpl |
| void SetCompositorContextVisibility(bool is_visible); |
| void SetWorkerContextVisibility(bool is_visible); |
| + // Cache & restore variables that get reset in ClearCurrentlyScrollingLayer. |
| + // This is used to restore the variables' values in a scrollBegin event |
| + // that is in inertial phase (a fling) to latch the event to its |
| + // corresponding scroller. |
| + void CacheScrollStateForFling(); |
| + void RestoreScrollStateForFling(); |
| + |
| using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; |
| UIResourceMap ui_resource_map_; |
| @@ -835,6 +876,8 @@ class CC_EXPORT LayerTreeHostImpl |
| std::unique_ptr<PendingTreeDurationHistogramTimer> |
| pending_tree_duration_timer_; |
| + ScrollStateForFling cached_scroll_state_for_fling_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| }; |