OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_IN_PROCESS_VIEW_RENDERER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "android_webview/browser/browser_view_renderer.h" | 10 #include "android_webview/browser/browser_view_renderer.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; | 58 virtual void DrawGL(AwDrawGLInfo* draw_info) OVERRIDE; |
59 virtual void SetGlobalVisibleRect(const gfx::Rect& visible_rect) OVERRIDE; | 59 virtual void SetGlobalVisibleRect(const gfx::Rect& visible_rect) OVERRIDE; |
60 virtual skia::RefPtr<SkPicture> CapturePicture(int width, | 60 virtual skia::RefPtr<SkPicture> CapturePicture(int width, |
61 int height) OVERRIDE; | 61 int height) OVERRIDE; |
62 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; | 62 virtual void EnableOnNewPicture(bool enabled) OVERRIDE; |
63 virtual void SetIsPaused(bool paused) OVERRIDE; | 63 virtual void SetIsPaused(bool paused) OVERRIDE; |
64 virtual void SetViewVisibility(bool visible) OVERRIDE; | 64 virtual void SetViewVisibility(bool visible) OVERRIDE; |
65 virtual void SetWindowVisibility(bool visible) OVERRIDE; | 65 virtual void SetWindowVisibility(bool visible) OVERRIDE; |
66 virtual void OnSizeChanged(int width, int height) OVERRIDE; | 66 virtual void OnSizeChanged(int width, int height) OVERRIDE; |
67 virtual void ScrollTo(gfx::Vector2d new_value) OVERRIDE; | 67 virtual void ScrollTo(gfx::Vector2d new_value) OVERRIDE; |
68 virtual void SetPageScaleFactor(float page_scale_factor) OVERRIDE; | |
69 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; | 68 virtual void OnAttachedToWindow(int width, int height) OVERRIDE; |
70 virtual void OnDetachedFromWindow() OVERRIDE; | 69 virtual void OnDetachedFromWindow() OVERRIDE; |
71 virtual void SetDipScale(float dip_scale) OVERRIDE; | 70 virtual void SetDipScale(float dip_scale) OVERRIDE; |
72 virtual bool IsAttachedToWindow() OVERRIDE; | 71 virtual bool IsAttachedToWindow() OVERRIDE; |
73 virtual bool IsVisible() OVERRIDE; | 72 virtual bool IsVisible() OVERRIDE; |
74 virtual gfx::Rect GetScreenRect() OVERRIDE; | 73 virtual gfx::Rect GetScreenRect() OVERRIDE; |
75 | 74 |
76 // SynchronousCompositorClient overrides | 75 // SynchronousCompositorClient overrides |
77 virtual void DidInitializeCompositor( | 76 virtual void DidInitializeCompositor( |
78 content::SynchronousCompositor* compositor) OVERRIDE; | 77 content::SynchronousCompositor* compositor) OVERRIDE; |
79 virtual void DidDestroyCompositor( | 78 virtual void DidDestroyCompositor( |
80 content::SynchronousCompositor* compositor) OVERRIDE; | 79 content::SynchronousCompositor* compositor) OVERRIDE; |
81 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; | 80 virtual void SetContinuousInvalidate(bool invalidate) OVERRIDE; |
| 81 virtual void SetMaxRootLayerScrollOffset(gfx::Vector2dF new_value) OVERRIDE; |
82 virtual void SetTotalRootLayerScrollOffset( | 82 virtual void SetTotalRootLayerScrollOffset( |
83 gfx::Vector2dF new_value_css) OVERRIDE; | 83 gfx::Vector2dF new_value_css) OVERRIDE; |
84 virtual void DidUpdateContent() OVERRIDE; | 84 virtual void DidUpdateContent() OVERRIDE; |
85 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; | 85 virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() OVERRIDE; |
| 86 virtual void SetRootLayerPageScaleFactor(float page_scale_factor) OVERRIDE; |
| 87 virtual void SetRootLayerScrollableSize(gfx::SizeF scrollable_size) OVERRIDE; |
86 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, | 88 virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
87 gfx::Vector2dF latest_overscroll_delta, | 89 gfx::Vector2dF latest_overscroll_delta, |
88 gfx::Vector2dF current_fling_velocity) OVERRIDE; | 90 gfx::Vector2dF current_fling_velocity) OVERRIDE; |
89 | 91 |
90 void WebContentsGone(); | 92 void WebContentsGone(); |
91 bool RequestProcessGL(); | 93 bool RequestProcessGL(); |
92 | 94 |
93 private: | 95 private: |
94 // Checks the continuous invalidate and block invalidate state, and schedule | 96 // Checks the continuous invalidate and block invalidate state, and schedule |
95 // invalidates appropriately. If |invalidate_ignore_compositor| is true, | 97 // invalidates appropriately. If |invalidate_ignore_compositor| is true, |
96 // then send a view invalidate regardless of compositor expectation. | 98 // then send a view invalidate regardless of compositor expectation. |
97 void EnsureContinuousInvalidation( | 99 void EnsureContinuousInvalidation( |
98 AwDrawGLInfo* draw_info, | 100 AwDrawGLInfo* draw_info, |
99 bool invalidate_ignore_compositor); | 101 bool invalidate_ignore_compositor); |
100 bool DrawSWInternal(jobject java_canvas, | 102 bool DrawSWInternal(jobject java_canvas, |
101 const gfx::Rect& clip_bounds); | 103 const gfx::Rect& clip_bounds); |
102 bool CompositeSW(SkCanvas* canvas); | 104 bool CompositeSW(SkCanvas* canvas); |
103 | 105 |
104 void UpdateCachedGlobalVisibleRect(); | 106 void UpdateCachedGlobalVisibleRect(); |
105 | 107 |
106 // If we call up view invalidate and OnDraw is not called before a deadline, | 108 // If we call up view invalidate and OnDraw is not called before a deadline, |
107 // then we keep ticking the SynchronousCompositor so it can make progress. | 109 // then we keep ticking the SynchronousCompositor so it can make progress. |
108 void FallbackTickFired(); | 110 void FallbackTickFired(); |
109 | 111 |
110 void NoLongerExpectsDrawGL(); | 112 void NoLongerExpectsDrawGL(); |
111 | 113 |
112 bool InitializeHwDraw(); | 114 bool InitializeHwDraw(); |
113 | 115 |
| 116 gfx::Vector2d max_scroll_offset() const; |
| 117 |
114 // For debug tracing or logging. Return the string representation of this | 118 // For debug tracing or logging. Return the string representation of this |
115 // view renderer's state and the |draw_info| if provided. | 119 // view renderer's state and the |draw_info| if provided. |
116 std::string ToString(AwDrawGLInfo* draw_info) const; | 120 std::string ToString(AwDrawGLInfo* draw_info) const; |
117 | 121 |
118 BrowserViewRenderer::Client* client_; | 122 BrowserViewRenderer::Client* client_; |
119 BrowserViewRenderer::JavaHelper* java_helper_; | 123 BrowserViewRenderer::JavaHelper* java_helper_; |
120 content::WebContents* web_contents_; | 124 content::WebContents* web_contents_; |
121 content::SynchronousCompositor* compositor_; | 125 content::SynchronousCompositor* compositor_; |
122 | 126 |
123 bool is_paused_; | 127 bool is_paused_; |
(...skipping 29 matching lines...) Expand all Loading... |
153 // Not to be used between draw calls. | 157 // Not to be used between draw calls. |
154 EGLContext last_egl_context_; | 158 EGLContext last_egl_context_; |
155 | 159 |
156 // Should always call UpdateCachedGlobalVisibleRect before using this. | 160 // Should always call UpdateCachedGlobalVisibleRect before using this. |
157 gfx::Rect cached_global_visible_rect_; | 161 gfx::Rect cached_global_visible_rect_; |
158 | 162 |
159 // Last View scroll when View.onDraw() was called. | 163 // Last View scroll when View.onDraw() was called. |
160 gfx::Vector2d scroll_at_start_of_frame_; | 164 gfx::Vector2d scroll_at_start_of_frame_; |
161 | 165 |
162 // Current scroll offset in CSS pixels. | 166 // Current scroll offset in CSS pixels. |
163 gfx::Vector2dF scroll_offset_css_; | 167 gfx::Vector2dF scroll_offset_dip_; |
| 168 |
| 169 // Max scroll offset in CSS pixels. |
| 170 gfx::Vector2dF max_scroll_offset_dip_; |
164 | 171 |
165 // Used to prevent rounding errors from accumulating enough to generate | 172 // Used to prevent rounding errors from accumulating enough to generate |
166 // visible skew (especially noticeable when scrolling up and down in the same | 173 // visible skew (especially noticeable when scrolling up and down in the same |
167 // spot over a period of time). | 174 // spot over a period of time). |
168 gfx::Vector2dF overscroll_rounding_error_; | 175 gfx::Vector2dF overscroll_rounding_error_; |
169 | 176 |
170 GLViewRendererManager::Key manager_key_; | 177 GLViewRendererManager::Key manager_key_; |
171 | 178 |
172 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); | 179 DISALLOW_COPY_AND_ASSIGN(InProcessViewRenderer); |
173 }; | 180 }; |
174 | 181 |
175 } // namespace android_webview | 182 } // namespace android_webview |
176 | 183 |
177 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ | 184 #endif // ANDROID_WEBVIEW_BROWSER_IN_PROCESS_VIEW_RENDERER_H_ |
OLD | NEW |