Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 75cc2fb5cbe3015ef1a4ecd215cde43cae31906a..b2557de9c920555438dbdf601ecd1b8b62091876 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -627,6 +627,8 @@ RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps, |
#if defined(OS_ANDROID) |
top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), |
#endif |
+ top_controls_shrink_blink_size_(false), |
+ top_controls_height_(0.f), |
has_focus_(false), |
has_scrolled_focused_editable_node_into_rect_(false), |
main_render_frame_(nullptr), |
@@ -2615,6 +2617,22 @@ void RenderViewImpl::OnResize(const ResizeParams& params) { |
gfx::Size old_visible_viewport_size = visible_viewport_size_; |
+ if (top_controls_height_ || params.top_controls_height) { |
+ // When top controls are present, we need to resize the Blink widget and |
+ // change the top controls height at the same time to prevent the viewport |
+ // from changing scroll offset due to a clamp in between the two operations. |
+ top_controls_shrink_blink_size_ = params.top_controls_shrink_blink_size; |
+ top_controls_height_ = params.top_controls_height; |
+ gfx::Size new_view_size = params.new_size; |
+ if (IsUseZoomForDSFEnabled()) { |
+ new_view_size = gfx::ScaleToCeiledSize(new_view_size, |
+ GetOriginalDeviceScaleFactor()); |
+ } |
+ webview()->resizeWithTopControls(new_view_size, |
no sievers
2016/04/08 19:26:02
webview() is null-checked everywhere else in OnRes
bokan
2016/04/11 19:54:15
This is gone now in addressing the comment below.
|
+ top_controls_height_, |
no sievers
2016/04/08 19:26:02
I find it slightly weird that we end up calling re
bokan
2016/04/11 19:54:15
I moved it since we didn't want this method to exi
|
+ top_controls_shrink_blink_size_); |
+ } |
+ |
RenderWidget::OnResize(params); |
if (old_visible_viewport_size != visible_viewport_size_) |