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

Unified Diff: cc/trees/layer_tree_host_impl.h

Issue 2423143002: Scrollbar fade animation broken on Android regression resolved. (Closed)
Patch Set: scrolling_layer_id cached. 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 side-by-side diff with in-line comments
Download patch
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 6d97f27511c28112ed55508cc8e9e0b4ccf27f20..8517101ce3ab477f75ab246af5880000944760e1 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -131,6 +131,38 @@ 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 its
+// corresponding scroll event.
tdresser 2016/10/26 15:38:18 It doesn't latch the fling to the scroll event, it
sahel 2016/10/26 18:47:45 Done.
+class ScrollStateForFling {
+ 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 scrollingLayerId() { return scrolling_layer_id_; }
bokan 2016/10/26 14:17:43 nit: these methods should all be of the style scro
sahel 2016/10/26 18:47:45 Done.
+ bool didLockScrollingLayer() { return did_lock_scrolling_layer_; }
+ bool scrollAffectsScrollHandler() { return scroll_affects_scroll_handler_; }
+ gfx::Vector2dF accumulatedRootOverscroll() {
+ 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
@@ -701,6 +733,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();
+ LayerImpl* RestoreScrollStateForFling();
+
using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>;
UIResourceMap ui_resource_map_;
@@ -841,6 +880,8 @@ class CC_EXPORT LayerTreeHostImpl
std::unique_ptr<PendingTreeDurationHistogramTimer>
pending_tree_duration_timer_;
+ ScrollStateForFling cached_scroll_state_for_fling_;
+
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698