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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // ContentViewCoreImpl represents the native side of the Java | 331 // ContentViewCoreImpl represents the native side of the Java |
332 // ContentViewCore. It being NULL means that it is not attached | 332 // ContentViewCore. It being NULL means that it is not attached |
333 // to the View system yet, so we treat this RWHVA as hidden. | 333 // to the View system yet, so we treat this RWHVA as hidden. |
334 return is_layer_attached_ && content_view_core_; | 334 return is_layer_attached_ && content_view_core_; |
335 } | 335 } |
336 | 336 |
337 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { | 337 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { |
338 if (!content_view_core_) | 338 if (!content_view_core_) |
339 return gfx::Rect(); | 339 return gfx::Rect(); |
340 | 340 |
341 // If the backing hasn't been initialized yet, report empty view bounds | |
342 // as well. Otherwise, we may end up stuck in a white-screen state because | |
343 // the resize ack is sent after swapbuffers. | |
344 if (GetPhysicalBackingSize().IsEmpty()) | |
345 return gfx::Rect(); | |
346 | |
347 gfx::Size size = content_view_core_->GetViewportSizeDip(); | 341 gfx::Size size = content_view_core_->GetViewportSizeDip(); |
348 gfx::Size offset = content_view_core_->GetViewportSizeOffsetDip(); | 342 gfx::Size offset = content_view_core_->GetViewportSizeOffsetDip(); |
349 size.Enlarge(-offset.width(), -offset.height()); | 343 size.Enlarge(-offset.width(), -offset.height()); |
350 | 344 |
351 return gfx::Rect(size); | 345 return gfx::Rect(size); |
352 } | 346 } |
353 | 347 |
354 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 348 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
355 if (!content_view_core_) | 349 if (!content_view_core_) |
356 return gfx::Size(); | 350 return gfx::Size(); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // RenderWidgetHostView, public: | 925 // RenderWidgetHostView, public: |
932 | 926 |
933 // static | 927 // static |
934 RenderWidgetHostView* | 928 RenderWidgetHostView* |
935 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 929 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
936 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 930 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
937 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 931 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
938 } | 932 } |
939 | 933 |
940 } // namespace content | 934 } // namespace content |
OLD | NEW |