| 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/cross_process_frame_connector.h" | 5 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
| 8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
| 9 #include "content/browser/compositor/surface_utils.h" | 9 #include "content/browser/compositor/surface_utils.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 device_scale_factor_ = scale_factor; | 240 device_scale_factor_ = scale_factor; |
| 241 // The RenderWidgetHost is null in unit tests. | 241 // The RenderWidgetHost is null in unit tests. |
| 242 if (view_ && view_->GetRenderWidgetHost()) { | 242 if (view_ && view_->GetRenderWidgetHost()) { |
| 243 RenderWidgetHostImpl* child_widget = | 243 RenderWidgetHostImpl* child_widget = |
| 244 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 244 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
| 245 child_widget->NotifyScreenInfoChanged(); | 245 child_widget->NotifyScreenInfoChanged(); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 void CrossProcessFrameConnector::SetRect(const gfx::Rect& frame_rect) { | 249 void CrossProcessFrameConnector::SetRect(const gfx::Rect& frame_rect) { |
| 250 gfx::Rect old_rect = child_frame_rect_; |
| 250 child_frame_rect_ = frame_rect; | 251 child_frame_rect_ = frame_rect; |
| 251 if (view_) | 252 if (view_) { |
| 252 view_->SetBounds(frame_rect); | 253 view_->SetBounds(frame_rect); |
| 254 |
| 255 // Out-of-process iframes nested underneath this one implicitly have their |
| 256 // view rects changed when their ancestor is repositioned, and therefore |
| 257 // need to have their screen rects updated. |
| 258 FrameTreeNode* proxy_node = |
| 259 frame_proxy_in_parent_renderer_->frame_tree_node(); |
| 260 if (old_rect.x() != child_frame_rect_.x() || |
| 261 old_rect.y() != child_frame_rect_.y()) { |
| 262 for (FrameTreeNode* node : |
| 263 proxy_node->frame_tree()->SubtreeNodes(proxy_node)) { |
| 264 if (node != proxy_node && |
| 265 node->current_frame_host()->GetRenderWidgetHost()) |
| 266 node->current_frame_host()->GetRenderWidgetHost()->SendScreenRects(); |
| 267 } |
| 268 } |
| 269 } |
| 253 } | 270 } |
| 254 | 271 |
| 255 RenderWidgetHostViewBase* | 272 RenderWidgetHostViewBase* |
| 256 CrossProcessFrameConnector::GetRootRenderWidgetHostView() { | 273 CrossProcessFrameConnector::GetRootRenderWidgetHostView() { |
| 257 RenderFrameHostImpl* top_host = frame_proxy_in_parent_renderer_-> | 274 RenderFrameHostImpl* top_host = frame_proxy_in_parent_renderer_-> |
| 258 frame_tree_node()->frame_tree()->root()->current_frame_host(); | 275 frame_tree_node()->frame_tree()->root()->current_frame_host(); |
| 259 | 276 |
| 260 // This method should return the root RWHV from the top-level WebContents, | 277 // This method should return the root RWHV from the top-level WebContents, |
| 261 // in the case of nested WebContents. | 278 // in the case of nested WebContents. |
| 262 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 279 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 284 | 301 |
| 285 if (parent) { | 302 if (parent) { |
| 286 return static_cast<RenderWidgetHostViewBase*>( | 303 return static_cast<RenderWidgetHostViewBase*>( |
| 287 parent->current_frame_host()->GetView()); | 304 parent->current_frame_host()->GetView()); |
| 288 } | 305 } |
| 289 | 306 |
| 290 return nullptr; | 307 return nullptr; |
| 291 } | 308 } |
| 292 | 309 |
| 293 } // namespace content | 310 } // namespace content |
| OLD | NEW |