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

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: add a todo Created 5 years, 6 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 SetNeedsAnimateScroll(
112 const AnimationCallback& scroll_animation) override;
110 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, 113 void DidOverscroll(gfx::Vector2dF accumulated_overscroll,
111 gfx::Vector2dF latest_overscroll_delta, 114 gfx::Vector2dF latest_overscroll_delta,
112 gfx::Vector2dF current_fling_velocity) override; 115 gfx::Vector2dF current_fling_velocity) override;
113 116
114 void UpdateParentDrawConstraints(); 117 void UpdateParentDrawConstraints();
115 void DetachFunctorFromView(); 118 void DetachFunctorFromView();
116 119
117 private: 120 private:
118 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); 121 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip);
119 bool CanOnDraw(); 122 bool CanOnDraw();
(...skipping 17 matching lines...) Expand all
137 // Do this in a two stage tick due to native MessageLoop favors delayed task, 140 // 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. 141 // so ensure delayed task is inserted only after the draw task returns.
139 void PostFallbackTick(); 142 void PostFallbackTick();
140 void FallbackTickFired(); 143 void FallbackTickFired();
141 144
142 // Force invoke the compositor to run produce a 1x1 software frame that is 145 // 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 146 // immediately discarded. This is a hack to force invoke parts of the
144 // compositor that are not directly exposed here. 147 // compositor that are not directly exposed here.
145 void ForceFakeCompositeSW(); 148 void ForceFakeCompositeSW();
146 149
150 // Honor the requested fling animation as contained in
151 // |pending_fling_animation_|.
152 void FlushPendingScrollAnimation(base::TimeTicks animation_time);
153
147 gfx::Vector2d max_scroll_offset() const; 154 gfx::Vector2d max_scroll_offset() const;
148 155
149 void UpdateMemoryPolicy(); 156 void UpdateMemoryPolicy();
150 157
151 // For debug tracing or logging. Return the string representation of this 158 // For debug tracing or logging. Return the string representation of this
152 // view renderer's state. 159 // view renderer's state.
153 std::string ToString() const; 160 std::string ToString() const;
154 161
155 BrowserViewRendererClient* client_; 162 BrowserViewRendererClient* client_;
156 SharedRendererState shared_renderer_state_; 163 SharedRendererState shared_renderer_state_;
(...skipping 15 matching lines...) Expand all
172 179
173 gfx::Vector2d last_on_draw_scroll_offset_; 180 gfx::Vector2d last_on_draw_scroll_offset_;
174 gfx::Rect last_on_draw_global_visible_rect_; 181 gfx::Rect last_on_draw_global_visible_rect_;
175 182
176 base::CancelableClosure post_fallback_tick_; 183 base::CancelableClosure post_fallback_tick_;
177 base::CancelableClosure fallback_tick_fired_; 184 base::CancelableClosure fallback_tick_fired_;
178 bool fallback_tick_pending_; 185 bool fallback_tick_pending_;
179 186
180 gfx::Size size_; 187 gfx::Size size_;
181 188
189 // Used to drive a fling animation as requested by the compositor. This acts
190 // as a single-shot animation; the compositor will continually post an
boliu 2015/05/29 19:42:47 nit: extra space
191 // animation callback as long as they're required.
192 AnimationCallback pending_fling_animation_;
193
182 // Current scroll offset in CSS pixels. 194 // Current scroll offset in CSS pixels.
183 gfx::Vector2dF scroll_offset_dip_; 195 gfx::Vector2dF scroll_offset_dip_;
184 196
185 // Max scroll offset in CSS pixels. 197 // Max scroll offset in CSS pixels.
186 gfx::Vector2dF max_scroll_offset_dip_; 198 gfx::Vector2dF max_scroll_offset_dip_;
187 199
188 // Used to prevent rounding errors from accumulating enough to generate 200 // Used to prevent rounding errors from accumulating enough to generate
189 // visible skew (especially noticeable when scrolling up and down in the same 201 // visible skew (especially noticeable when scrolling up and down in the same
190 // spot over a period of time). 202 // spot over a period of time).
191 gfx::Vector2dF overscroll_rounding_error_; 203 gfx::Vector2dF overscroll_rounding_error_;
192 204
193 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); 205 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer);
194 }; 206 };
195 207
196 } // namespace android_webview 208 } // namespace android_webview
197 209
198 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ 210 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer.cc » ('j') | android_webview/browser/browser_view_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698