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 return content_view_core_->GetViewportSizeOffsetDip().height(); |
Ted C
2014/08/19 01:14:28
I would be nice to converge these two ("ViewportSi
aelias_OOO_until_Jul13
2014/08/19 21:28:39
OK, I changed the name everywhere upstream, exposi
| |
545 } | 545 } |
546 | 546 |
547 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { | 547 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { |
548 // There are no cursors on Android. | 548 // There are no cursors on Android. |
549 } | 549 } |
550 | 550 |
551 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 551 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
552 // Do nothing. The UI notification is handled through ContentViewClient which | 552 // Do nothing. The UI notification is handled through ContentViewClient which |
553 // is TabContentsDelegate. | 553 // is TabContentsDelegate. |
554 } | 554 } |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
960 | 960 |
961 ack_callbacks_.push(ack_callback); | 961 ack_callbacks_.push(ack_callback); |
962 if (host_->is_hidden()) | 962 if (host_->is_hidden()) |
963 RunAckCallbacks(); | 963 RunAckCallbacks(); |
964 } | 964 } |
965 | 965 |
966 void RenderWidgetHostViewAndroid::ComputeContentsSize( | 966 void RenderWidgetHostViewAndroid::ComputeContentsSize( |
967 const cc::CompositorFrameMetadata& frame_metadata) { | 967 const cc::CompositorFrameMetadata& frame_metadata) { |
968 // Calculate the content size. This should be 0 if the texture_size is 0. | 968 // Calculate the content size. This should be 0 if the texture_size is 0. |
969 gfx::Vector2dF offset; | 969 gfx::Vector2dF offset; |
970 if (texture_size_in_layer_.GetArea() > 0) | 970 if (texture_size_in_layer_.IsEmpty()) |
971 offset = frame_metadata.location_bar_content_translation; | 971 content_size_in_layer_ = gfx::Size(); |
972 offset.set_y(offset.y() + frame_metadata.overdraw_bottom_height); | 972 content_size_in_layer_ = gfx::ToCeiledSize(gfx::ScaleSize( |
973 offset.Scale(frame_metadata.device_scale_factor); | 973 frame_metadata.scrollable_viewport_size, |
974 content_size_in_layer_ = | 974 frame_metadata.device_scale_factor * frame_metadata.page_scale_factor)); |
975 gfx::Size(texture_size_in_layer_.width() - offset.x(), | |
976 texture_size_in_layer_.height() - offset.y()); | |
977 | 975 |
978 if (overscroll_effect_) { | 976 if (overscroll_effect_) { |
979 overscroll_effect_->UpdateDisplayParameters( | 977 overscroll_effect_->UpdateDisplayParameters( |
980 CreateOverscrollDisplayParameters(frame_metadata)); | 978 CreateOverscrollDisplayParameters(frame_metadata)); |
981 } | 979 } |
982 } | 980 } |
983 | 981 |
984 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( | 982 void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
985 uint32 output_surface_id, | 983 uint32 output_surface_id, |
986 scoped_ptr<cc::CompositorFrame> frame) { | 984 scoped_ptr<cc::CompositorFrame> frame) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1155 | 1153 |
1156 // All offsets and sizes are in CSS pixels. | 1154 // All offsets and sizes are in CSS pixels. |
1157 content_view_core_->UpdateFrameInfo( | 1155 content_view_core_->UpdateFrameInfo( |
1158 frame_metadata.root_scroll_offset, | 1156 frame_metadata.root_scroll_offset, |
1159 frame_metadata.page_scale_factor, | 1157 frame_metadata.page_scale_factor, |
1160 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1158 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1161 frame_metadata.max_page_scale_factor), | 1159 frame_metadata.max_page_scale_factor), |
1162 frame_metadata.root_layer_size, | 1160 frame_metadata.root_layer_size, |
1163 frame_metadata.scrollable_viewport_size, | 1161 frame_metadata.scrollable_viewport_size, |
1164 frame_metadata.location_bar_offset, | 1162 frame_metadata.location_bar_offset, |
1165 frame_metadata.location_bar_content_translation, | 1163 frame_metadata.location_bar_content_translation); |
1166 frame_metadata.overdraw_bottom_height); | |
1167 #if defined(VIDEO_HOLE) | 1164 #if defined(VIDEO_HOLE) |
1168 if (host_ && host_->IsRenderView()) { | 1165 if (host_ && host_->IsRenderView()) { |
1169 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1166 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
1170 RenderViewHost::From(host_)); | 1167 RenderViewHost::From(host_)); |
1171 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1168 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
1172 } | 1169 } |
1173 #endif // defined(VIDEO_HOLE) | 1170 #endif // defined(VIDEO_HOLE) |
1174 } | 1171 } |
1175 | 1172 |
1176 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, | 1173 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1742 results->orientationAngle = display.RotationAsDegree(); | 1739 results->orientationAngle = display.RotationAsDegree(); |
1743 results->orientationType = | 1740 results->orientationType = |
1744 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1741 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1745 gfx::DeviceDisplayInfo info; | 1742 gfx::DeviceDisplayInfo info; |
1746 results->depth = info.GetBitsPerPixel(); | 1743 results->depth = info.GetBitsPerPixel(); |
1747 results->depthPerComponent = info.GetBitsPerComponent(); | 1744 results->depthPerComponent = info.GetBitsPerComponent(); |
1748 results->isMonochrome = (results->depthPerComponent == 0); | 1745 results->isMonochrome = (results->depthPerComponent == 0); |
1749 } | 1746 } |
1750 | 1747 |
1751 } // namespace content | 1748 } // namespace content |
OLD | NEW |