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

Side by Side 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, 1 month 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
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 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <bitset> 10 #include <bitset>
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; 124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0;
125 125
126 // Called when output surface asks for a draw. 126 // Called when output surface asks for a draw.
127 virtual void OnDrawForCompositorFrameSink( 127 virtual void OnDrawForCompositorFrameSink(
128 bool resourceless_software_draw) = 0; 128 bool resourceless_software_draw) = 0;
129 129
130 protected: 130 protected:
131 virtual ~LayerTreeHostImplClient() {} 131 virtual ~LayerTreeHostImplClient() {}
132 }; 132 };
133 133
134 // Used to cache scroll related variables that get reset while clearing
135 // the currently scrolling layer. Cached values are restored in case of a
136 // scrollBegin in inertial phase (fling) to latch the fling to its
137 // corresponding scroll event.
138 class ScrollingVariablesState {
139 public:
140 ScrollingVariablesState() {
141 ScrollingVariablesState(false, false, gfx::Vector2dF());
142 }
143 ScrollingVariablesState(bool did_lock_scrolling_layer,
144 bool scroll_affects_scroll_handler,
145 gfx::Vector2dF accumulated_root_overscroll)
146 : did_lock_scrolling_layer_(did_lock_scrolling_layer),
147 scroll_affects_scroll_handler_(scroll_affects_scroll_handler),
148 accumulated_root_overscroll_(accumulated_root_overscroll) {}
149
150 bool didLockScrollingLayer() { return did_lock_scrolling_layer_; }
151 bool scrollAffectsScrollHandler() { return scroll_affects_scroll_handler_; }
152 gfx::Vector2dF accumulatedRootOverscroll() {
153 return accumulated_root_overscroll_;
154 }
155
156 private:
157 bool did_lock_scrolling_layer_;
158 bool scroll_affects_scroll_handler_;
159 gfx::Vector2dF accumulated_root_overscroll_;
160 };
161
134 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering 162 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
135 // state. 163 // state.
136 class CC_EXPORT LayerTreeHostImpl 164 class CC_EXPORT LayerTreeHostImpl
137 : public InputHandler, 165 : public InputHandler,
138 public TileManagerClient, 166 public TileManagerClient,
139 public CompositorFrameSinkClient, 167 public CompositorFrameSinkClient,
140 public TopControlsManagerClient, 168 public TopControlsManagerClient,
141 public ScrollbarAnimationControllerClient, 169 public ScrollbarAnimationControllerClient,
142 public VideoFrameControllerClient, 170 public VideoFrameControllerClient,
143 public LayerTreeMutatorClient, 171 public LayerTreeMutatorClient,
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 722
695 void ScrollAnimationAbort(LayerImpl* layer_impl); 723 void ScrollAnimationAbort(LayerImpl* layer_impl);
696 724
697 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node, 725 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node,
698 const gfx::Vector2dF& scroll_delta, 726 const gfx::Vector2dF& scroll_delta,
699 base::TimeDelta delayed_by); 727 base::TimeDelta delayed_by);
700 728
701 void SetCompositorContextVisibility(bool is_visible); 729 void SetCompositorContextVisibility(bool is_visible);
702 void SetWorkerContextVisibility(bool is_visible); 730 void SetWorkerContextVisibility(bool is_visible);
703 731
732 // Cache & restore variables that get reset in ClearCurrentlyScrollingLayer.
733 // This is used to restore the variables' values in a scrollBegin event
734 // that is in inertial phase (a fling) to latch the event to its
735 // corresponding scroller.
736 void CacheScrollingVariablesState();
737 void RestoreCachedScrollingVariablesState();
738
704 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; 739 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>;
705 UIResourceMap ui_resource_map_; 740 UIResourceMap ui_resource_map_;
706 741
707 // Resources that were evicted by EvictAllUIResources. Resources are removed 742 // Resources that were evicted by EvictAllUIResources. Resources are removed
708 // from this when they are touched by a create or destroy from the UI resource 743 // from this when they are touched by a create or destroy from the UI resource
709 // request queue. 744 // request queue.
710 std::set<UIResourceId> evicted_ui_resources_; 745 std::set<UIResourceId> evicted_ui_resources_;
711 746
712 CompositorFrameSink* compositor_frame_sink_; 747 CompositorFrameSink* compositor_frame_sink_;
713 748
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 // it's lost instead of having this bool. 869 // it's lost instead of having this bool.
835 bool has_valid_compositor_frame_sink_; 870 bool has_valid_compositor_frame_sink_;
836 871
837 std::unique_ptr<Viewport> viewport_; 872 std::unique_ptr<Viewport> viewport_;
838 873
839 std::unique_ptr<LayerTreeMutator> mutator_; 874 std::unique_ptr<LayerTreeMutator> mutator_;
840 875
841 std::unique_ptr<PendingTreeDurationHistogramTimer> 876 std::unique_ptr<PendingTreeDurationHistogramTimer>
842 pending_tree_duration_timer_; 877 pending_tree_duration_timer_;
843 878
879 ScrollingVariablesState cached_scrolling_variables_state_;
880
844 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 881 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
845 }; 882 };
846 883
847 } // namespace cc 884 } // namespace cc
848 885
849 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 886 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698