OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "android_webview/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
6 | 6 |
7 #include "android_webview/browser/browser_view_renderer_client.h" | 7 #include "android_webview/browser/browser_view_renderer_client.h" |
8 #include "android_webview/browser/shared_renderer_state.h" | 8 #include "android_webview/browser/shared_renderer_state.h" |
9 #include "android_webview/common/aw_switches.h" | 9 #include "android_webview/common/aw_switches.h" |
10 #include "android_webview/public/browser/draw_gl.h" | 10 #include "android_webview/public/browser/draw_gl.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 gfx::Rect clip = viewport; | 292 gfx::Rect clip = viewport; |
293 gfx::Transform transform_for_tile_priority = | 293 gfx::Transform transform_for_tile_priority = |
294 parent_draw_constraints_.transform; | 294 parent_draw_constraints_.transform; |
295 | 295 |
296 // If the WebView is on a layer, WebView does not know what transform is | 296 // If the WebView is on a layer, WebView does not know what transform is |
297 // applied onto the layer so global visible rect does not make sense here. | 297 // applied onto the layer so global visible rect does not make sense here. |
298 // In this case, just use the surface rect for tiling. | 298 // In this case, just use the surface rect for tiling. |
299 gfx::Rect viewport_rect_for_tile_priority; | 299 gfx::Rect viewport_rect_for_tile_priority; |
300 if (parent_draw_constraints_.is_layer) | 300 if (parent_draw_constraints_.is_layer) |
301 viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect; | 301 viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect; |
302 else | 302 else if (!last_on_draw_global_visible_rect_.IsEmpty()) |
303 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; | 303 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; |
| 304 else { |
| 305 // An empty viewport rect for tile priority will make cc fallback to use |
| 306 // the WebView size as viewport rect for tile priority, which is not what |
| 307 // we want. Instead, use the smallest non-empty rect for it. |
| 308 viewport_rect_for_tile_priority = gfx::Rect(0, 0, 1, 1); |
| 309 } |
304 | 310 |
305 scoped_ptr<cc::CompositorFrame> frame = | 311 scoped_ptr<cc::CompositorFrame> frame = |
306 compositor_->DemandDrawHw(surface_size, | 312 compositor_->DemandDrawHw(surface_size, |
307 gfx::Transform(), | 313 gfx::Transform(), |
308 viewport, | 314 viewport, |
309 clip, | 315 clip, |
310 viewport_rect_for_tile_priority, | 316 viewport_rect_for_tile_priority, |
311 transform_for_tile_priority); | 317 transform_for_tile_priority); |
312 if (!frame.get()) | 318 if (!frame.get()) |
313 return false; | 319 return false; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 base::StringAppendF(&str, | 821 base::StringAppendF(&str, |
816 "surface width height: [%d %d] ", | 822 "surface width height: [%d %d] ", |
817 draw_info->width, | 823 draw_info->width, |
818 draw_info->height); | 824 draw_info->height); |
819 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); | 825 base::StringAppendF(&str, "is_layer: %d ", draw_info->is_layer); |
820 } | 826 } |
821 return str; | 827 return str; |
822 } | 828 } |
823 | 829 |
824 } // namespace android_webview | 830 } // namespace android_webview |
OLD | NEW |