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

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: Remove unnecessary cast 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 2df0d57380936eb22f1841bd5b7162d7dfda7018..59155ca03939c4faa35aee239641c2338ebfa4a6 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,27 @@ 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 hits 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.
+ bool is_guest = BrowserPluginGuest::IsGuest(RenderViewHostImpl::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_;
}
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_child_frame.h ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698