| Index: android_webview/browser/browser_view_renderer.cc
|
| diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc
|
| index 33fad4f66416fd69484580d57e6aa7c97a4af619..1420846562bf7c2591f73ae40b7656f7a8ef433e 100644
|
| --- a/android_webview/browser/browser_view_renderer.cc
|
| +++ b/android_webview/browser/browser_view_renderer.cc
|
| @@ -85,6 +85,7 @@ BrowserViewRenderer::BrowserViewRenderer(
|
| on_new_picture_enable_(false),
|
| clear_view_(false),
|
| compositor_needs_continuous_invalidate_(false),
|
| + invalidate_after_composite_(false),
|
| block_invalidates_(false),
|
| fallback_tick_pending_(false),
|
| width_(0),
|
| @@ -208,13 +209,6 @@ bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) {
|
| return false;
|
|
|
| shared_renderer_state_->SetScrollOffset(last_on_draw_scroll_offset_);
|
| - if (last_on_draw_global_visible_rect_.IsEmpty()) {
|
| - TRACE_EVENT_INSTANT0("android_webview",
|
| - "EarlyOut_EmptyVisibleRect",
|
| - TRACE_EVENT_SCOPE_THREAD);
|
| - shared_renderer_state_->SetForceInvalidateOnNextDrawGL(true);
|
| - return client_->RequestDrawGL(java_canvas, false);
|
| - }
|
|
|
| if (!hardware_enabled_) {
|
| hardware_enabled_ = compositor_->InitializeHwDraw();
|
| @@ -225,6 +219,15 @@ bool BrowserViewRenderer::OnDrawHardware(jobject java_canvas) {
|
| if (!hardware_enabled_)
|
| return false;
|
|
|
| + if (last_on_draw_global_visible_rect_.IsEmpty() &&
|
| + !parent_draw_constraints_.surface_rect.IsEmpty()) {
|
| + TRACE_EVENT_INSTANT0("android_webview",
|
| + "EarlyOut_EmptyVisibleRect",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + shared_renderer_state_->SetForceInvalidateOnNextDrawGL(true);
|
| + return client_->RequestDrawGL(java_canvas, false);
|
| + }
|
| +
|
| ReturnResourceFromParent();
|
| if (shared_renderer_state_->HasCompositorFrame()) {
|
| TRACE_EVENT_INSTANT0("android_webview",
|
| @@ -259,10 +262,12 @@ scoped_ptr<cc::CompositorFrame> BrowserViewRenderer::CompositeHw() {
|
| // applied onto the layer so global visible rect does not make sense here.
|
| // In this case, just use the surface rect for tiling.
|
| gfx::Rect viewport_rect_for_tile_priority;
|
| - if (parent_draw_constraints_.is_layer)
|
| + if (parent_draw_constraints_.is_layer ||
|
| + last_on_draw_global_visible_rect_.IsEmpty()) {
|
| viewport_rect_for_tile_priority = parent_draw_constraints_.surface_rect;
|
| - else
|
| + } else {
|
| viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_;
|
| + }
|
|
|
| scoped_ptr<cc::CompositorFrame> frame =
|
| compositor_->DemandDrawHw(surface_size,
|
| @@ -648,12 +653,18 @@ void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll,
|
| void BrowserViewRenderer::EnsureContinuousInvalidation(
|
| bool force_invalidate,
|
| bool skip_reschedule_tick) {
|
| + if (force_invalidate)
|
| + invalidate_after_composite_ = true;
|
| +
|
| // This method should be called again when any of these conditions change.
|
| bool need_invalidate =
|
| - compositor_needs_continuous_invalidate_ || force_invalidate;
|
| + compositor_needs_continuous_invalidate_ || invalidate_after_composite_;
|
| if (!need_invalidate || block_invalidates_)
|
| return;
|
|
|
| + if (!compositor_needs_continuous_invalidate_ && invalidate_after_composite_)
|
| + invalidate_after_composite_ = false;
|
| +
|
| // Always call view invalidate. We rely the Android framework to ignore the
|
| // invalidate when it's not needed such as when view is not visible.
|
| client_->PostInvalidate();
|
|
|