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

Side by Side 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 unified diff | Download patch
OLDNEW
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // The parent_view can be null in tests when using a TestWebContents. 115 // The parent_view can be null in tests when using a TestWebContents.
116 if (parent_view) { 116 if (parent_view) {
117 // Translate frame_rect by the parent's RenderWidgetHostView offset. 117 // Translate frame_rect by the parent's RenderWidgetHostView offset.
118 rect.Offset(parent_view->GetViewBounds().OffsetFromOrigin()); 118 rect.Offset(parent_view->GetViewBounds().OffsetFromOrigin());
119 } 119 }
120 } 120 }
121 return rect; 121 return rect;
122 } 122 }
123 123
124 gfx::Size RenderWidgetHostViewChildFrame::GetVisibleViewportSize() const {
125 // For subframes, the visual viewport corresponds to the main frame size, so
126 // this bubbles up to the parent until it will hit the main frame's
127 // RenderWidgetHostView.
128 //
129 // Currently this excludes webview guests, since they expect the visual
130 // viewport to return the guest's size rather than the page's; one reason why
131 // is that Blink ends up using the visual viewport to calculate things like
132 // window.innerWidth/innerHeight for main frames, and a guest is considered
133 // 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
134 bool is_guest = BrowserPluginGuest::IsGuest(
135 static_cast<RenderViewHostImpl*>(RenderViewHost::From(host_)));
136 if (frame_connector_ && !is_guest) {
137 RenderWidgetHostView* parent_view =
138 frame_connector_->GetParentRenderWidgetHostView();
139 // The parent_view can be null in unit tests when using a TestWebContents.
140 if (parent_view)
141 return parent_view->GetVisibleViewportSize();
142 }
143 return GetViewBounds().size();
144 }
145
124 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const { 146 gfx::Vector2dF RenderWidgetHostViewChildFrame::GetLastScrollOffset() const {
125 return last_scroll_offset_; 147 return last_scroll_offset_;
126 } 148 }
127 149
128 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const { 150 gfx::NativeView RenderWidgetHostViewChildFrame::GetNativeView() const {
129 NOTREACHED(); 151 NOTREACHED();
130 return NULL; 152 return NULL;
131 } 153 }
132 154
133 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const { 155 gfx::NativeViewId RenderWidgetHostViewChildFrame::GetNativeViewId() const {
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (surface_factory_ && !surface_id_.is_null()) 591 if (surface_factory_ && !surface_id_.is_null())
570 surface_factory_->Destroy(surface_id_); 592 surface_factory_->Destroy(surface_id_);
571 surface_id_ = cc::SurfaceId(); 593 surface_id_ = cc::SurfaceId();
572 } 594 }
573 595
574 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 596 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
575 return surface_id_; 597 return surface_id_;
576 }; 598 };
577 599
578 } // namespace content 600 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698