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

Unified Diff: cc/trees/layer_tree_host_impl.h

Issue 2423143002: Scrollbar fade animation broken on Android regression resolved. (Closed)
Patch Set: unittest added. 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..6722a7c0cc4ab49d5d6099b0306ce50875758f34 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -131,6 +131,34 @@ 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.
+class ScrollingVariablesState {
+ public:
+ ScrollingVariablesState() {
+ ScrollingVariablesState(false, false, gfx::Vector2dF());
+ }
+ ScrollingVariablesState(bool did_lock_scrolling_layer,
+ bool scroll_affects_scroll_handler,
+ gfx::Vector2dF accumulated_root_overscroll)
+ : did_lock_scrolling_layer_(did_lock_scrolling_layer),
+ scroll_affects_scroll_handler_(scroll_affects_scroll_handler),
+ accumulated_root_overscroll_(accumulated_root_overscroll) {}
+
+ bool didLockScrollingLayer() { return did_lock_scrolling_layer_; }
+ bool scrollAffectsScrollHandler() { return scroll_affects_scroll_handler_; }
+ gfx::Vector2dF accumulatedRootOverscroll() {
+ return accumulated_root_overscroll_;
+ }
+
+ private:
+ 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 +729,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 CacheScrollingVariablesState();
+ void RestoreCachedScrollingVariablesState();
+
using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>;
UIResourceMap ui_resource_map_;
@@ -841,6 +876,8 @@ class CC_EXPORT LayerTreeHostImpl
std::unique_ptr<PendingTreeDurationHistogramTimer>
pending_tree_duration_timer_;
+ ScrollingVariablesState cached_scrolling_variables_state_;
+
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698