| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 // this bubbles up to the parent until it hits the main frame's | 225 // this bubbles up to the parent until it hits the main frame's |
| 226 // RenderWidgetHostView. | 226 // RenderWidgetHostView. |
| 227 // | 227 // |
| 228 // Currently this excludes webview guests, since they expect the visual | 228 // Currently this excludes webview guests, since they expect the visual |
| 229 // viewport to return the guest's size rather than the page's; one reason why | 229 // viewport to return the guest's size rather than the page's; one reason why |
| 230 // is that Blink ends up using the visual viewport to calculate things like | 230 // is that Blink ends up using the visual viewport to calculate things like |
| 231 // window.innerWidth/innerHeight for main frames, and a guest is considered | 231 // window.innerWidth/innerHeight for main frames, and a guest is considered |
| 232 // to be a main frame. This should be cleaned up eventually. | 232 // to be a main frame. This should be cleaned up eventually. |
| 233 bool is_guest = BrowserPluginGuest::IsGuest(RenderViewHostImpl::From(host_)); | 233 bool is_guest = BrowserPluginGuest::IsGuest(RenderViewHostImpl::From(host_)); |
| 234 if (frame_connector_ && !is_guest) { | 234 if (frame_connector_ && !is_guest) { |
| 235 // An auto-resize set by the top-level frame overrides what would be |
| 236 // reported by embedding RenderWidgetHostViews. |
| 237 if (host_->delegate() && !host_->delegate()->GetAutoResizeSize().IsEmpty()) |
| 238 return host_->delegate()->GetAutoResizeSize(); |
| 239 |
| 235 RenderWidgetHostView* parent_view = | 240 RenderWidgetHostView* parent_view = |
| 236 frame_connector_->GetParentRenderWidgetHostView(); | 241 frame_connector_->GetParentRenderWidgetHostView(); |
| 237 // The parent_view can be null in unit tests when using a TestWebContents. | 242 // The parent_view can be null in unit tests when using a TestWebContents. |
| 238 if (parent_view) | 243 if (parent_view) |
| 239 return parent_view->GetVisibleViewportSize(); | 244 return parent_view->GetVisibleViewportSize(); |
| 240 } | 245 } |
| 241 return GetViewBounds().size(); | 246 return GetViewBounds().size(); |
| 242 } | 247 } |
| 243 | 248 |
| 244 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const { | 249 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const { |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 auto origin = GetViewBounds().origin() - | 827 auto origin = GetViewBounds().origin() - |
| 823 frame_connector_->GetRootRenderWidgetHostView() | 828 frame_connector_->GetRootRenderWidgetHostView() |
| 824 ->GetViewBounds() | 829 ->GetViewBounds() |
| 825 .origin(); | 830 .origin(); |
| 826 return gfx::Point(origin.x(), origin.y()); | 831 return gfx::Point(origin.x(), origin.y()); |
| 827 } | 832 } |
| 828 return gfx::Point(); | 833 return gfx::Point(); |
| 829 } | 834 } |
| 830 | 835 |
| 831 } // namespace content | 836 } // namespace content |
| OLD | NEW |