| OLD | NEW |
| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void SetOffscreenPreRaster(bool enabled); | 66 void SetOffscreenPreRaster(bool enabled); |
| 67 | 67 |
| 68 // View update notifications. | 68 // View update notifications. |
| 69 void SetIsPaused(bool paused); | 69 void SetIsPaused(bool paused); |
| 70 void SetViewVisibility(bool visible); | 70 void SetViewVisibility(bool visible); |
| 71 void SetWindowVisibility(bool visible); | 71 void SetWindowVisibility(bool visible); |
| 72 void OnSizeChanged(int width, int height); | 72 void OnSizeChanged(int width, int height); |
| 73 void OnAttachedToWindow(int width, int height); | 73 void OnAttachedToWindow(int width, int height); |
| 74 void OnDetachedFromWindow(); | 74 void OnDetachedFromWindow(); |
| 75 void OnComputeScroll(base::TimeTicks animation_time); |
| 75 | 76 |
| 76 // Sets the scale for logical<->physical pixel conversions. | 77 // Sets the scale for logical<->physical pixel conversions. |
| 77 void SetDipScale(float dip_scale); | 78 void SetDipScale(float dip_scale); |
| 78 | 79 |
| 79 // Set the root layer scroll offset to |new_value|. | 80 // Set the root layer scroll offset to |new_value|. |
| 80 void ScrollTo(gfx::Vector2d new_value); | 81 void ScrollTo(gfx::Vector2d new_value); |
| 81 | 82 |
| 82 // Android views hierarchy gluing. | 83 // Android views hierarchy gluing. |
| 83 bool IsVisible() const; | 84 bool IsVisible() const; |
| 84 gfx::Rect GetScreenRect() const; | 85 gfx::Rect GetScreenRect() const; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 97 void SetContinuousInvalidate(bool invalidate) override; | 98 void SetContinuousInvalidate(bool invalidate) override; |
| 98 void DidUpdateContent() override; | 99 void DidUpdateContent() override; |
| 99 gfx::Vector2dF GetTotalRootLayerScrollOffset() override; | 100 gfx::Vector2dF GetTotalRootLayerScrollOffset() override; |
| 100 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip, | 101 void UpdateRootLayerState(const gfx::Vector2dF& total_scroll_offset_dip, |
| 101 const gfx::Vector2dF& max_scroll_offset_dip, | 102 const gfx::Vector2dF& max_scroll_offset_dip, |
| 102 const gfx::SizeF& scrollable_size_dip, | 103 const gfx::SizeF& scrollable_size_dip, |
| 103 float page_scale_factor, | 104 float page_scale_factor, |
| 104 float min_page_scale_factor, | 105 float min_page_scale_factor, |
| 105 float max_page_scale_factor) override; | 106 float max_page_scale_factor) override; |
| 106 bool IsExternalFlingActive() const override; | 107 bool IsExternalFlingActive() const override; |
| 108 void SetNeedsAnimateFling(const AnimationCallback& fling_animation) override; |
| 107 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 109 void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
| 108 gfx::Vector2dF latest_overscroll_delta, | 110 gfx::Vector2dF latest_overscroll_delta, |
| 109 gfx::Vector2dF current_fling_velocity) override; | 111 gfx::Vector2dF current_fling_velocity) override; |
| 110 | 112 |
| 111 void UpdateParentDrawConstraints(); | 113 void UpdateParentDrawConstraints(); |
| 112 void DidSkipCommitFrame(); | 114 void DidSkipCommitFrame(); |
| 113 void DetachFunctorFromView(); | 115 void DetachFunctorFromView(); |
| 114 | 116 |
| 115 private: | 117 private: |
| 116 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); | 118 void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value_dip); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 138 // 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, |
| 139 // 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. |
| 140 void PostFallbackTick(); | 142 void PostFallbackTick(); |
| 141 void FallbackTickFired(); | 143 void FallbackTickFired(); |
| 142 | 144 |
| 143 // 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 |
| 144 // 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 |
| 145 // compositor that are not directly exposed here. | 147 // compositor that are not directly exposed here. |
| 146 void ForceFakeCompositeSW(); | 148 void ForceFakeCompositeSW(); |
| 147 | 149 |
| 150 // Honor the requested fling animation as contained in |
| 151 // |pending_fling_animation_|. |
| 152 void FlushPendingFlingAnimation(base::TimeTicks animation_time); |
| 153 |
| 148 gfx::Vector2d max_scroll_offset() const; | 154 gfx::Vector2d max_scroll_offset() const; |
| 149 | 155 |
| 150 size_t CalculateDesiredMemoryPolicy(); | 156 size_t CalculateDesiredMemoryPolicy(); |
| 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_; |
| 157 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 163 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 187 | 193 |
| 188 // Used to block additional invalidates while one is already pending. | 194 // Used to block additional invalidates while one is already pending. |
| 189 bool block_invalidates_; | 195 bool block_invalidates_; |
| 190 | 196 |
| 191 base::CancelableClosure post_fallback_tick_; | 197 base::CancelableClosure post_fallback_tick_; |
| 192 base::CancelableClosure fallback_tick_fired_; | 198 base::CancelableClosure fallback_tick_fired_; |
| 193 bool fallback_tick_pending_; | 199 bool fallback_tick_pending_; |
| 194 | 200 |
| 195 gfx::Size size_; | 201 gfx::Size size_; |
| 196 | 202 |
| 203 // Used to drive a fling animation as requested by the compositor. This acts |
| 204 // as a single-shot animation; the compositor will continually post an |
| 205 // animation callback as long as they're required. |
| 206 AnimationCallback pending_fling_animation_; |
| 207 |
| 197 // Current scroll offset in CSS pixels. | 208 // Current scroll offset in CSS pixels. |
| 198 gfx::Vector2dF scroll_offset_dip_; | 209 gfx::Vector2dF scroll_offset_dip_; |
| 199 | 210 |
| 200 // Max scroll offset in CSS pixels. | 211 // Max scroll offset in CSS pixels. |
| 201 gfx::Vector2dF max_scroll_offset_dip_; | 212 gfx::Vector2dF max_scroll_offset_dip_; |
| 202 | 213 |
| 203 // Used to prevent rounding errors from accumulating enough to generate | 214 // Used to prevent rounding errors from accumulating enough to generate |
| 204 // visible skew (especially noticeable when scrolling up and down in the same | 215 // visible skew (especially noticeable when scrolling up and down in the same |
| 205 // spot over a period of time). | 216 // spot over a period of time). |
| 206 gfx::Vector2dF overscroll_rounding_error_; | 217 gfx::Vector2dF overscroll_rounding_error_; |
| 207 | 218 |
| 208 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); | 219 DISALLOW_COPY_AND_ASSIGN(BrowserViewRenderer); |
| 209 }; | 220 }; |
| 210 | 221 |
| 211 } // namespace android_webview | 222 } // namespace android_webview |
| 212 | 223 |
| 213 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ | 224 #endif // ANDROID_WEBVIEW_BROWSER_BROWSER_VIEW_RENDERER_H_ |
| OLD | NEW |