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/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 return gfx::Rect(content_view_core_->GetViewSize()); | 561 return gfx::Rect(content_view_core_->GetViewSize()); |
562 } | 562 } |
563 | 563 |
564 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 564 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
565 if (!content_view_core_) | 565 if (!content_view_core_) |
566 return gfx::Size(); | 566 return gfx::Size(); |
567 | 567 |
568 return content_view_core_->GetPhysicalBackingSize(); | 568 return content_view_core_->GetPhysicalBackingSize(); |
569 } | 569 } |
570 | 570 |
571 float RenderWidgetHostViewAndroid::GetOverdrawBottomHeight() const { | 571 float RenderWidgetHostViewAndroid::GetTopControlsLayoutHeight() const { |
572 if (!content_view_core_) | 572 if (!content_view_core_) |
573 return 0.f; | 573 return 0.f; |
574 | 574 |
575 return content_view_core_->GetOverdrawBottomHeightDip(); | 575 // The amount that the viewport size given to Blink is shrunk by the URL-bar. |
| 576 return content_view_core_->GetTopControlsLayoutHeightDip(); |
576 } | 577 } |
577 | 578 |
578 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { | 579 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { |
579 // There are no cursors on Android. | 580 // There are no cursors on Android. |
580 } | 581 } |
581 | 582 |
582 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 583 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
583 // Do nothing. The UI notification is handled through ContentViewClient which | 584 // Do nothing. The UI notification is handled through ContentViewClient which |
584 // is TabContentsDelegate. | 585 // is TabContentsDelegate. |
585 } | 586 } |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 | 998 |
998 ack_callbacks_.push(ack_callback); | 999 ack_callbacks_.push(ack_callback); |
999 if (host_->is_hidden()) | 1000 if (host_->is_hidden()) |
1000 RunAckCallbacks(); | 1001 RunAckCallbacks(); |
1001 } | 1002 } |
1002 | 1003 |
1003 void RenderWidgetHostViewAndroid::ComputeContentsSize( | 1004 void RenderWidgetHostViewAndroid::ComputeContentsSize( |
1004 const cc::CompositorFrameMetadata& frame_metadata) { | 1005 const cc::CompositorFrameMetadata& frame_metadata) { |
1005 // Calculate the content size. This should be 0 if the texture_size is 0. | 1006 // Calculate the content size. This should be 0 if the texture_size is 0. |
1006 gfx::Vector2dF offset; | 1007 gfx::Vector2dF offset; |
1007 if (texture_size_in_layer_.GetArea() > 0) | 1008 if (texture_size_in_layer_.IsEmpty()) |
1008 offset = frame_metadata.location_bar_content_translation; | 1009 content_size_in_layer_ = gfx::Size(); |
1009 offset.set_y(offset.y() + frame_metadata.overdraw_bottom_height); | 1010 content_size_in_layer_ = gfx::ToCeiledSize(gfx::ScaleSize( |
1010 offset.Scale(frame_metadata.device_scale_factor); | 1011 frame_metadata.scrollable_viewport_size, |
1011 content_size_in_layer_ = | 1012 frame_metadata.device_scale_factor * frame_metadata.page_scale_factor)); |
1012 gfx::Size(texture_size_in_layer_.width() - offset.x(), | |
1013 texture_size_in_layer_.height() - offset.y()); | |
1014 | 1013 |
1015 if (overscroll_effect_) { | 1014 if (overscroll_effect_) { |
1016 overscroll_effect_->UpdateDisplayParameters( | 1015 overscroll_effect_->UpdateDisplayParameters( |
1017 CreateOverscrollDisplayParameters(frame_metadata)); | 1016 CreateOverscrollDisplayParameters(frame_metadata)); |
1018 } | 1017 } |
1019 } | 1018 } |
1020 | 1019 |
1021 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( | 1020 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
1022 uint32 output_surface_id, | 1021 uint32 output_surface_id, |
1023 scoped_ptr<cc::CompositorFrame> frame) { | 1022 scoped_ptr<cc::CompositorFrame> frame) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 | 1203 |
1205 // All offsets and sizes are in CSS pixels. | 1204 // All offsets and sizes are in CSS pixels. |
1206 content_view_core_->UpdateFrameInfo( | 1205 content_view_core_->UpdateFrameInfo( |
1207 frame_metadata.root_scroll_offset, | 1206 frame_metadata.root_scroll_offset, |
1208 frame_metadata.page_scale_factor, | 1207 frame_metadata.page_scale_factor, |
1209 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1208 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1210 frame_metadata.max_page_scale_factor), | 1209 frame_metadata.max_page_scale_factor), |
1211 frame_metadata.root_layer_size, | 1210 frame_metadata.root_layer_size, |
1212 frame_metadata.scrollable_viewport_size, | 1211 frame_metadata.scrollable_viewport_size, |
1213 frame_metadata.location_bar_offset, | 1212 frame_metadata.location_bar_offset, |
1214 frame_metadata.location_bar_content_translation, | 1213 frame_metadata.location_bar_content_translation); |
1215 frame_metadata.overdraw_bottom_height); | |
1216 #if defined(VIDEO_HOLE) | 1214 #if defined(VIDEO_HOLE) |
1217 if (host_ && host_->IsRenderView()) { | 1215 if (host_ && host_->IsRenderView()) { |
1218 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1216 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1219 RenderViewHost::From(host_)); | 1217 RenderViewHost::From(host_)); |
1220 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1218 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
1221 } | 1219 } |
1222 #endif // defined(VIDEO_HOLE) | 1220 #endif // defined(VIDEO_HOLE) |
1223 } | 1221 } |
1224 | 1222 |
1225 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, | 1223 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 results->orientationAngle = display.RotationAsDegree(); | 1794 results->orientationAngle = display.RotationAsDegree(); |
1797 results->orientationType = | 1795 results->orientationType = |
1798 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1796 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1799 gfx::DeviceDisplayInfo info; | 1797 gfx::DeviceDisplayInfo info; |
1800 results->depth = info.GetBitsPerPixel(); | 1798 results->depth = info.GetBitsPerPixel(); |
1801 results->depthPerComponent = info.GetBitsPerComponent(); | 1799 results->depthPerComponent = info.GetBitsPerComponent(); |
1802 results->isMonochrome = (results->depthPerComponent == 0); | 1800 results->isMonochrome = (results->depthPerComponent == 0); |
1803 } | 1801 } |
1804 | 1802 |
1805 } // namespace content | 1803 } // namespace content |
OLD | NEW |