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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 return gfx::Rect(content_view_core_->GetViewSize()); | 530 return gfx::Rect(content_view_core_->GetViewSize()); |
531 } | 531 } |
532 | 532 |
533 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 533 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
534 if (!content_view_core_) | 534 if (!content_view_core_) |
535 return gfx::Size(); | 535 return gfx::Size(); |
536 | 536 |
537 return content_view_core_->GetPhysicalBackingSize(); | 537 return content_view_core_->GetPhysicalBackingSize(); |
538 } | 538 } |
539 | 539 |
540 float RenderWidgetHostViewAndroid::GetOverdrawBottomHeight() const { | 540 float RenderWidgetHostViewAndroid::GetTopControlsLayoutHeight() const { |
541 if (!content_view_core_) | 541 if (!content_view_core_) |
542 return 0.f; | 542 return 0.f; |
543 | 543 |
544 return content_view_core_->GetOverdrawBottomHeightDip(); | 544 // The amount that the viewport size given to Blink is shrunk by the URL-bar. |
| 545 return content_view_core_->GetTopControlsLayoutHeightDip(); |
545 } | 546 } |
546 | 547 |
547 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { | 548 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { |
548 // There are no cursors on Android. | 549 // There are no cursors on Android. |
549 } | 550 } |
550 | 551 |
551 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 552 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
552 // Do nothing. The UI notification is handled through ContentViewClient which | 553 // Do nothing. The UI notification is handled through ContentViewClient which |
553 // is TabContentsDelegate. | 554 // is TabContentsDelegate. |
554 } | 555 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 | 964 |
964 ack_callbacks_.push(ack_callback); | 965 ack_callbacks_.push(ack_callback); |
965 if (host_->is_hidden()) | 966 if (host_->is_hidden()) |
966 RunAckCallbacks(); | 967 RunAckCallbacks(); |
967 } | 968 } |
968 | 969 |
969 void RenderWidgetHostViewAndroid::ComputeContentsSize( | 970 void RenderWidgetHostViewAndroid::ComputeContentsSize( |
970 const cc::CompositorFrameMetadata& frame_metadata) { | 971 const cc::CompositorFrameMetadata& frame_metadata) { |
971 // Calculate the content size. This should be 0 if the texture_size is 0. | 972 // Calculate the content size. This should be 0 if the texture_size is 0. |
972 gfx::Vector2dF offset; | 973 gfx::Vector2dF offset; |
973 if (texture_size_in_layer_.GetArea() > 0) | 974 if (texture_size_in_layer_.IsEmpty()) |
974 offset = frame_metadata.location_bar_content_translation; | 975 content_size_in_layer_ = gfx::Size(); |
975 offset.set_y(offset.y() + frame_metadata.overdraw_bottom_height); | 976 content_size_in_layer_ = gfx::ToCeiledSize(gfx::ScaleSize( |
976 offset.Scale(frame_metadata.device_scale_factor); | 977 frame_metadata.scrollable_viewport_size, |
977 content_size_in_layer_ = | 978 frame_metadata.device_scale_factor * frame_metadata.page_scale_factor)); |
978 gfx::Size(texture_size_in_layer_.width() - offset.x(), | |
979 texture_size_in_layer_.height() - offset.y()); | |
980 | 979 |
981 if (overscroll_effect_) { | 980 if (overscroll_effect_) { |
982 overscroll_effect_->UpdateDisplayParameters( | 981 overscroll_effect_->UpdateDisplayParameters( |
983 CreateOverscrollDisplayParameters(frame_metadata)); | 982 CreateOverscrollDisplayParameters(frame_metadata)); |
984 } | 983 } |
985 } | 984 } |
986 | 985 |
987 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( | 986 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
988 uint32 output_surface_id, | 987 uint32 output_surface_id, |
989 scoped_ptr<cc::CompositorFrame> frame) { | 988 scoped_ptr<cc::CompositorFrame> frame) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 | 1157 |
1159 // All offsets and sizes are in CSS pixels. | 1158 // All offsets and sizes are in CSS pixels. |
1160 content_view_core_->UpdateFrameInfo( | 1159 content_view_core_->UpdateFrameInfo( |
1161 frame_metadata.root_scroll_offset, | 1160 frame_metadata.root_scroll_offset, |
1162 frame_metadata.page_scale_factor, | 1161 frame_metadata.page_scale_factor, |
1163 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1162 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1164 frame_metadata.max_page_scale_factor), | 1163 frame_metadata.max_page_scale_factor), |
1165 frame_metadata.root_layer_size, | 1164 frame_metadata.root_layer_size, |
1166 frame_metadata.scrollable_viewport_size, | 1165 frame_metadata.scrollable_viewport_size, |
1167 frame_metadata.location_bar_offset, | 1166 frame_metadata.location_bar_offset, |
1168 frame_metadata.location_bar_content_translation, | 1167 frame_metadata.location_bar_content_translation); |
1169 frame_metadata.overdraw_bottom_height); | |
1170 #if defined(VIDEO_HOLE) | 1168 #if defined(VIDEO_HOLE) |
1171 if (host_ && host_->IsRenderView()) { | 1169 if (host_ && host_->IsRenderView()) { |
1172 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1170 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1173 RenderViewHost::From(host_)); | 1171 RenderViewHost::From(host_)); |
1174 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1172 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
1175 } | 1173 } |
1176 #endif // defined(VIDEO_HOLE) | 1174 #endif // defined(VIDEO_HOLE) |
1177 } | 1175 } |
1178 | 1176 |
1179 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, | 1177 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 results->orientationAngle = display.RotationAsDegree(); | 1743 results->orientationAngle = display.RotationAsDegree(); |
1746 results->orientationType = | 1744 results->orientationType = |
1747 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1745 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1748 gfx::DeviceDisplayInfo info; | 1746 gfx::DeviceDisplayInfo info; |
1749 results->depth = info.GetBitsPerPixel(); | 1747 results->depth = info.GetBitsPerPixel(); |
1750 results->depthPerComponent = info.GetBitsPerComponent(); | 1748 results->depthPerComponent = info.GetBitsPerComponent(); |
1751 results->isMonochrome = (results->depthPerComponent == 0); | 1749 results->isMonochrome = (results->depthPerComponent == 0); |
1752 } | 1750 } |
1753 | 1751 |
1754 } // namespace content | 1752 } // namespace content |
OLD | NEW |