Chromium Code Reviews| 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..79e4ebee63ef2012a64dfb1f524f00cc1c3b9037 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 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( |
| + static_cast<RenderViewHostImpl*>(RenderViewHost::From(host_))); |
|
dcheng
2016/03/31 23:07:54
By the way, I think you can write RenderViewHostIm
alexmos
2016/04/01 00:44:54
Done.
|
| + 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_; |
| } |