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

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 1834913002: Fix visual viewport for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix webview and unit tests Created 4 years, 9 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
Index: content/browser/frame_host/render_widget_host_view_child_frame.cc
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 7232c547aa112d80c6d0b0c8c2b2509cd0bda623..efaf5d366c20260e4396e58849a5816093ea986e 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -121,6 +121,28 @@ gfx::Rect RenderWidgetHostViewChildFrame::GetViewBounds() const {
return rect;
}
+gfx::Size RenderWidgetHostViewChildFrame::GetVisibleViewportSize() const {
+ // For subframes, the visual viewport corresponds to the main frame size, so
+ // this bubbles up to the parent until it will hit the main frame's
+ // RenderWidgetHostView.
+ //
+ // Currently this excludes webview guests, since they expect the visual
+ // viewport to return the guest's size rather than the page's; one reason why
+ // is that Blink ends up using the visual viewport to calculate things like
+ // window.innerWidth/innerHeight for main frames, and a guest is considered
+ // to be a main frame. This should be cleaned up eventually.
alexmos 2016/03/26 00:00:48 I'm not quite sure about this, and in general abou
kenrb 2016/03/31 17:41:58 I don't quite understand what having a separate vi
+ bool is_guest = BrowserPluginGuest::IsGuest(
+ static_cast<RenderViewHostImpl*>(RenderViewHost::From(host_)));
+ if (frame_connector_ && !is_guest) {
+ RenderWidgetHostView* parent_view =
+ frame_connector_->GetParentRenderWidgetHostView();
+ // The parent_view can be null in unit tests when using a TestWebContents.
+ if (parent_view)
+ return parent_view->GetVisibleViewportSize();
+ }
+ return GetViewBounds().size();
+}
+
gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
return last_scroll_offset_;
}

Powered by Google App Engine
This is Rietveld 408576698