Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Unified Diff: content/renderer/render_view_impl.cc

Issue 1844013002: Fix main thread top controls scrolling to mirror CC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@propertyTreesBoundsDelta
Patch Set: aelias@ review: moved combined resize into WebView Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_)
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698