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 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_; |
| } |