Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index bee676ccad0a560288c9ea6fa10aa8d949b1b53b..5c163318f418c61bbaf0c541502ae76936342679 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -420,8 +420,10 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
const gfx::Vector2dF& page_scale_factor_limits, |
const gfx::SizeF& content_size, |
const gfx::SizeF& viewport_size, |
- const gfx::Vector2dF& controls_offset, |
- const gfx::Vector2dF& content_offset, |
+ const float top_controls_height, |
+ const float top_controls_shown_ratio, |
+ const float bottom_controls_height, |
+ const float bottom_controls_shown_ratio, |
bool is_mobile_optimized_hint, |
const gfx::SelectionBound& selection_start) { |
JNIEnv* env = AttachCurrentThread(); |
@@ -429,8 +431,9 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
if (obj.is_null() || !view_.GetWindowAndroid()) |
return; |
- view_.GetWindowAndroid()->set_content_offset( |
- gfx::ScaleVector2d(content_offset, dpi_scale_)); |
+ view_.GetWindowAndroid()->set_content_offset(gfx::ScaleVector2d( |
+ gfx::Vector2dF(0.0f, top_controls_height * top_controls_shown_ratio), |
+ dpi_scale_)); |
page_scale_ = page_scale_factor; |
@@ -457,8 +460,10 @@ void ContentViewCoreImpl::UpdateFrameInfo( |
content_size.height(), |
viewport_size.width(), |
viewport_size.height(), |
- controls_offset.y(), |
- content_offset.y(), |
+ top_controls_height, |
+ top_controls_shown_ratio, |
+ bottom_controls_height, |
+ bottom_controls_shown_ratio, |
is_mobile_optimized_hint, |
has_insertion_marker, |
is_insertion_marker_visible, |
@@ -784,7 +789,7 @@ gfx::Size ContentViewCoreImpl::GetViewSizeWithOSKHidden() const { |
gfx::Size ContentViewCoreImpl::GetViewSize() const { |
gfx::Size size = GetViewportSizeDip(); |
if (DoTopControlsShrinkBlinkSize()) |
- size.Enlarge(0, -GetTopControlsHeightDip()); |
+ size.Enlarge(0, -GetTopControlsHeightDip() - GetBottomControlsHeightDip()); |
return size; |
} |
@@ -816,6 +821,14 @@ int ContentViewCoreImpl::GetTopControlsHeightPix() const { |
return Java_ContentViewCore_getTopControlsHeightPix(env, j_obj.obj()); |
} |
+int ContentViewCoreImpl::GetBottomControlsHeightPix() const { |
+ JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
+ if (j_obj.is_null()) |
+ return 0; |
+ return Java_ContentViewCore_getBottomControlsHeightPix(env, j_obj.obj()); |
+} |
+ |
gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { |
return gfx::ScaleToCeiledSize(GetViewportSizePix(), 1.0f / dpi_scale()); |
} |
@@ -832,6 +845,10 @@ float ContentViewCoreImpl::GetTopControlsHeightDip() const { |
return GetTopControlsHeightPix() / dpi_scale(); |
} |
+float ContentViewCoreImpl::GetBottomControlsHeightDip() const { |
+ return GetBottomControlsHeightPix() / dpi_scale(); |
+} |
+ |
void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { |
view_.GetLayer()->InsertChild(layer, 0); |
view_.GetLayer()->SetIsDrawable(false); |