From 54af0352fb8c3b48b0f379ea1c48006aa1c34615 Mon Sep 17 00:00:00 2001 From: "aelias@chromium.org" <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Thu, 5 Sep 2013 00:43:28 +0000 Subject: Fix UpdateTilePriorities viewport in Android WebView. This patch fixes the tile management viewport to be the on-screen-visible rect for the last hardware draw. There are two problems I needed to solve: 1) Suppress UpdateTilePriorities from happening when the last draw was a software draw, which is specified by the new "viewport_valid_for_tile_management" bool. 2) In some cases, the clip rect is smaller than the WebView's visible viewport -- for example when the Android Browser progress bar is forcing redraws, the clip is only a small area at the top of the screen. I switched to using the visible viewport for UpdateDrawProperties + glViewport, and introduce a separate "DeviceClip" to override glScissor. (It's necessary to make the change at this level, rather than directly plumbing the visible viewport to UpdateTilePriorities, because UpdateTilePriorities also makes use of outputs from the draw properties calculation.) I also cleaned up all uses of device_viewport_size() to call DrawViewportSize() instead, with the sole exception of UnscaledScrollableViewportSize() which should continue to use the main-thread device_viewport_size_ in all cases (because that's the viewport for scrolling, not drawing). New tests: PictureLayerImplTest.SuppressUpdateTilePriorities, ExternalStencilPixelTest.DeviceClip NOTRY=true BUG=232844 Review URL: https://chromiumcodereview.appspot.com/23171014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221321 0039d316-1c4b-4281-b951-d872f2087c98 --- android_webview/browser/in_process_view_renderer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'android_webview/browser') diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc index bcf2ca4..7964cfd 100644 --- a/android_webview/browser/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_view_renderer.cc @@ -387,15 +387,20 @@ void InProcessViewRenderer::DrawGL(AwDrawGLInfo* draw_info) { // Assume we always draw the full visible rect if we are drawing into a layer. bool drew_full_visible_rect = true; + gfx::Rect viewport_rect; if (!draw_info->is_layer) { - clip_rect.Intersect(cached_global_visible_rect_); - drew_full_visible_rect = clip_rect.Contains(cached_global_visible_rect_); + viewport_rect = cached_global_visible_rect_; + clip_rect.Intersect(viewport_rect); + drew_full_visible_rect = clip_rect.Contains(viewport_rect); + } else { + viewport_rect = clip_rect; } block_invalidates_ = true; // TODO(joth): Check return value. compositor_->DemandDrawHw(gfx::Size(draw_info->width, draw_info->height), transform, + viewport_rect, clip_rect, state_restore.stencil_enabled()); block_invalidates_ = false; -- cgit v1.1