Propagate auto-resize viewport values to OOPIF processes
RenderWidgetHostViewChildFrame currently gets its visible viewport size
from the top-level RenderWidgetHostView, which typically comes from the
platform window. However, when the top-level frame has auto-resize
enabled, internally it sets its own visible viewport, and this
information not available to OOPIF children. This causes issues
in particular for extension popups which have window sizes of (0, 0)
and rely on auto-resize to modify the viewport in Blink.
This patch causes the WebContents to store the auto-resize value
reported by the top-level frame and make it available to OOPIF
RenderWidgetHostViews. They, in turn, allow an auto-resize size to
override the windows size when determining their visible viewport.
BUG=726743
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation
Review-Url: https://codereview.chromium.org/2914013004
Cr-Commit-Position: refs/heads/master@{#476772}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index e71d078c..3b58932 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -668,6 +668,8 @@
bool width_changed) override;
void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host,
const gfx::Size& new_size) override;
+ gfx::Size GetAutoResizeSize() override;
+ void ResetAutoResizeSize() override;
void ScreenInfoChanged() override;
void UpdateDeviceScaleFactor(double device_scale_factor) override;
void GetScreenInfo(ScreenInfo* screen_info) override;
@@ -1446,6 +1448,10 @@
// this overrides |preferred_size_|.
gfx::Size preferred_size_for_capture_;
+ // Size set by a top-level frame with auto-resize enabled. This is needed by
+ // out-of-process iframes for their visible viewport size.
+ gfx::Size auto_resize_size_;
+
#if defined(OS_ANDROID)
// Date time chooser opened by this tab.
// Only used in Android since all other platforms use a multi field UI.