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

Side by Side Diff: android_webview/browser/browser_view_renderer.h

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 6 #define ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
7 7
8 #include "android_webview/browser/parent_compositor_draw_constraints.h" 8 #include "android_webview/browser/parent_compositor_draw_constraints.h"
9 #include "android_webview/browser/shared_renderer_state.h" 9 #include "android_webview/browser/shared_renderer_state.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 void SetOffscreenPreRaster(bool enabled); 68 void SetOffscreenPreRaster(bool enabled);
69 69
70 // View update notifications. 70 // View update notifications.
71 void SetIsPaused(bool paused); 71 void SetIsPaused(bool paused);
72 void SetViewVisibility(bool visible); 72 void SetViewVisibility(bool visible);
73 void SetWindowVisibility(bool visible); 73 void SetWindowVisibility(bool visible);
74 void OnSizeChanged(int width, int height); 74 void OnSizeChanged(int width, int height);
75 void OnAttachedToWindow(int width, int height); 75 void OnAttachedToWindow(int width, int height);
76 void OnDetachedFromWindow(); 76 void OnDetachedFromWindow();
77 void OnComputeScroll(base::TimeTicks animation_time);
77 78
78 // Sets the scale for logical<->physical pixel conversions. 79 // Sets the scale for logical<->physical pixel conversions.
79 void SetDipScale(float dip_scale); 80 void SetDipScale(float dip_scale);
80 float dip_scale() const { return dip_scale_; } 81 float dip_scale() const { return dip_scale_; }
81 82
82 // Set the root layer scroll offset to |new_value|. 83 // Set the root layer scroll offset to |new_value|.
83 void ScrollTo(gfx::Vector2d new_value); 84 void ScrollTo(gfx::Vector2d new_value);
84 85
85 // Android views hierarchy gluing. 86 // Android views hierarchy gluing.
86 bool IsVisible() const; 87 bool IsVisible() const;
(...skipping 12 matching lines...) Expand all
99 content::SynchronousCompositor* compositor) override; 100 content::SynchronousCompositor* compositor) override;
100 void PostInvalidate() override; 101 void PostInvalidate() override;
101 void DidUpdateContent() override; 102 void DidUpdateContent() override;
102 gfx::Vector2dF GetTotalRootLayerScrollOffset() override; 103 gfx::Vector2dF GetTotalRootLayerScrollOffset() override;
103 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip, 104 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip,
104 const gfx::Vector2dF& max_scroll_offset_dip, 105 const gfx::Vector2dF& max_scroll_offset_dip,
105 const gfx::SizeF& scrollable_size_dip, 106 const gfx::SizeF& scrollable_size_dip,
106 float page_scale_factor, 107 float page_scale_factor,
107 float min_page_scale_factor, 108 float min_page_scale_factor,
108 float max_page_scale_factor) override; 109 float max_page_scale_factor) override;
109 bool IsExternalFlingActive() const override; 110 bool IsExternalScrollActive() const override;
111 void SetNeedsAnimateFling(const AnimationCallback& fling_animation) override;
jdduke (slow) 2015/05/18 21:18:34 Let's go ahead and rename this to |SetNeedsAnimate
hush (inactive) 2015/05/19 18:14:59 Done.
110 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, 112 void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
111 gfx::Vector2dF latest_overscroll_delta, 113 gfx::Vector2dF latest_overscroll_delta,
112 gfx::Vector2dF current_fling_velocity) override; 114 gfx::Vector2dF current_fling_velocity) override;
113 115
114 void UpdateParentDrawConstraints(); 116 void UpdateParentDrawConstraints();
115 void DetachFunctorFromView(); 117 void DetachFunctorFromView();
116 118
117 private: 119 private:
118 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); 120 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
119 bool CanOnDraw(); 121 bool CanOnDraw();
(...skipping 17 matching lines...) Expand all
137 // Do this in a two stage tick due to native MessageLoop favors delayed task, 139 // Do this in a two stage tick due to native MessageLoop favors delayed task,
138 // so ensure delayed task is inserted only after the draw task returns. 140 // so ensure delayed task is inserted only after the draw task returns.
139 void PostFallbackTick(); 141 void PostFallbackTick();
140 void FallbackTickFired(); 142 void FallbackTickFired();
141 143
142 // Force invoke the compositor to run produce a 1x1 software frame that is 144 // Force invoke the compositor to run produce a 1x1 software frame that is
143 // immediately discarded. This is a hack to force invoke parts of the 145 // immediately discarded. This is a hack to force invoke parts of the
144 // compositor that are not directly exposed here. 146 // compositor that are not directly exposed here.
145 void ForceFakeCompositeSW(); 147 void ForceFakeCompositeSW();
146 148
149 // Honor the requested fling animation as contained in
150 // |pending_fling_animation_|.
151 void FlushPendingFlingAnimation(base::TimeTicks animation_time);
152
147 gfx::Vector2d max_scroll_offset() const; 153 gfx::Vector2d max_scroll_offset() const;
148 154
149 void UpdateMemoryPolicy(); 155 void UpdateMemoryPolicy();
150 156
151 // For debug tracing or logging. Return the string representation of this 157 // For debug tracing or logging. Return the string representation of this
152 // view renderer's state. 158 // view renderer's state.
153 std::string ToString() const; 159 std::string ToString() const;
154 160
155 BrowserViewRendererClient* client_; 161 BrowserViewRendererClient* client_;
156 SharedRendererState shared_renderer_state_; 162 SharedRendererState shared_renderer_state_;
(...skipping 15 matching lines...) Expand all
172 178
173 gfx::Vector2d last_on_draw_scroll_offset_; 179 gfx::Vector2d last_on_draw_scroll_offset_;
174 gfx::Rect last_on_draw_global_visible_rect_; 180 gfx::Rect last_on_draw_global_visible_rect_;
175 181
176 base::CancelableClosure post_fallback_tick_; 182 base::CancelableClosure post_fallback_tick_;
177 base::CancelableClosure fallback_tick_fired_; 183 base::CancelableClosure fallback_tick_fired_;
178 bool fallback_tick_pending_; 184 bool fallback_tick_pending_;
179 185
180 gfx::Size size_; 186 gfx::Size size_;
181 187
188 // Used to drive a fling animation as requested by the compositor. This acts
189 // as a single-shot animation; the compositor will continually post an
190 // animation callback as long as they're required.
191 AnimationCallback pending_fling_animation_;
192
182 // Current scroll offset in CSS pixels. 193 // Current scroll offset in CSS pixels.
183 gfx::Vector2dF scroll_offset_dip_; 194 gfx::Vector2dF scroll_offset_dip_;
184 195
185 // Max scroll offset in CSS pixels. 196 // Max scroll offset in CSS pixels.
186 gfx::Vector2dF max_scroll_offset_dip_; 197 gfx::Vector2dF max_scroll_offset_dip_;
187 198
188 // Used to prevent rounding errors from accumulating enough to generate 199 // Used to prevent rounding errors from accumulating enough to generate
189 // visible skew (especially noticeable when scrolling up and down in the same 200 // visible skew (especially noticeable when scrolling up and down in the same
190 // spot over a period of time). 201 // spot over a period of time).
191 gfx::Vector2dF overscroll_rounding_error_; 202 gfx::Vector2dF overscroll_rounding_error_;
192 203
193 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 204 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
194 }; 205 };
195 206
196 } // namespace android_webview 207 } // namespace android_webview
197 208
198 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 209 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698