OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // ContentViewCoreImpl represents the native side of the Java | 328 // ContentViewCoreImpl represents the native side of the Java |
329 // ContentViewCore. It being NULL means that it is not attached | 329 // ContentViewCore. It being NULL means that it is not attached |
330 // to the View system yet, so we treat this RWHVA as hidden. | 330 // to the View system yet, so we treat this RWHVA as hidden. |
331 return is_layer_attached_ && content_view_core_; | 331 return is_layer_attached_ && content_view_core_; |
332 } | 332 } |
333 | 333 |
334 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 334 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
335 if (!content_view_core_) | 335 if (!content_view_core_) |
336 return gfx::Rect(); | 336 return gfx::Rect(); |
337 | 337 |
338 // If the backing hasn't been initialized yet, report empty view bounds | |
339 // as well. Otherwise, we may end up stuck in a white-screen state because | |
340 // the resize ack is sent after swapbuffers. | |
341 if (GetPhysicalBackingSize().IsEmpty()) | |
342 return gfx::Rect(); | |
343 | |
344 gfx::Size size = content_view_core_->GetViewportSizeDip(); | 338 gfx::Size size = content_view_core_->GetViewportSizeDip(); |
345 gfx::Size offset = content_view_core_->GetViewportSizeOffsetDip(); | 339 gfx::Size offset = content_view_core_->GetViewportSizeOffsetDip(); |
346 size.Enlarge(-offset.width(), -offset.height()); | 340 size.Enlarge(-offset.width(), -offset.height()); |
347 | 341 |
348 return gfx::Rect(size); | 342 return gfx::Rect(size); |
349 } | 343 } |
350 | 344 |
351 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 345 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
352 if (!content_view_core_) | 346 if (!content_view_core_) |
353 return gfx::Size(); | 347 return gfx::Size(); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 // RenderWidgetHostView, public: | 932 // RenderWidgetHostView, public: |
939 | 933 |
940 // static | 934 // static |
941 RenderWidgetHostView* | 935 RenderWidgetHostView* |
942 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 936 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
943 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 937 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
944 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 938 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
945 } | 939 } |
946 | 940 |
947 } // namespace content | 941 } // namespace content |
OLD | NEW |