| 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 "core/frame/RemoteFrameView.h" | 5 #include "core/frame/RemoteFrameView.h" |
| 6 | 6 |
| 7 #include "core/dom/IntersectionObserverEntry.h" | 7 #include "core/dom/IntersectionObserverEntry.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/RemoteFrame.h" | 10 #include "core/frame/RemoteFrame.h" |
| 11 #include "core/frame/RemoteFrameClient.h" | 11 #include "core/frame/RemoteFrameClient.h" |
| 12 #include "core/html/HTMLFrameOwnerElement.h" | 12 #include "core/html/HTMLFrameOwnerElement.h" |
| 13 #include "core/layout/LayoutView.h" | 13 #include "core/layout/LayoutView.h" |
| 14 #include "core/layout/api/LayoutPartItem.h" | 14 #include "core/layout/api/LayoutPartItem.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 RemoteFrameView::RemoteFrameView(RemoteFrame* remote_frame) | 18 RemoteFrameView::RemoteFrameView(RemoteFrame* remote_frame) |
| 19 : remote_frame_(remote_frame) { | 19 : remote_frame_(remote_frame) { |
| 20 DCHECK(remote_frame); | 20 DCHECK(remote_frame); |
| 21 } | 21 } |
| 22 | 22 |
| 23 RemoteFrameView::~RemoteFrameView() {} | 23 RemoteFrameView::~RemoteFrameView() {} |
| 24 | 24 |
| 25 void RemoteFrameView::SetParent(FrameViewBase* parent_frame_view_base) { | 25 void RemoteFrameView::SetParent(FrameView* parent) { |
| 26 FrameView* parent = ToFrameView(parent_frame_view_base); | |
| 27 if (parent == parent_) | 26 if (parent == parent_) |
| 28 return; | 27 return; |
| 29 | 28 |
| 30 DCHECK(!parent || !parent_); | 29 DCHECK(!parent || !parent_); |
| 31 if (!parent || !parent->IsVisible()) | 30 if (!parent || !parent->IsVisible()) |
| 32 SetParentVisible(false); | 31 SetParentVisible(false); |
| 33 parent_ = parent; | 32 parent_ = parent; |
| 34 if (parent && parent->IsVisible()) | 33 if (parent && parent->IsVisible()) |
| 35 SetParentVisible(true); | 34 SetParentVisible(true); |
| 36 FrameRectsChanged(); | 35 FrameRectsChanged(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (parent_visible_ == visible) | 130 if (parent_visible_ == visible) |
| 132 return; | 131 return; |
| 133 | 132 |
| 134 parent_visible_ = visible; | 133 parent_visible_ = visible; |
| 135 if (!self_visible_) | 134 if (!self_visible_) |
| 136 return; | 135 return; |
| 137 | 136 |
| 138 remote_frame_->Client()->VisibilityChanged(self_visible_ && parent_visible_); | 137 remote_frame_->Client()->VisibilityChanged(self_visible_ && parent_visible_); |
| 139 } | 138 } |
| 140 | 139 |
| 141 IntRect RemoteFrameView::ConvertFromContainingFrameViewBase( | 140 IntRect RemoteFrameView::ConvertFromRootFrame( |
| 142 const IntRect& parent_rect) const { | 141 const IntRect& rect_in_root_frame) const { |
| 143 if (const FrameView* parent = ToFrameView(Parent())) { | 142 if (parent_) { |
| 144 IntRect local_rect = parent_rect; | 143 IntRect parent_rect = parent_->ConvertFromRootFrame(rect_in_root_frame); |
| 145 local_rect.SetLocation( | 144 parent_rect.SetLocation( |
| 146 parent->ConvertSelfToChild(this, local_rect.Location())); | 145 parent_->ConvertSelfToChild(*this, parent_rect.Location())); |
| 147 return local_rect; | 146 return parent_rect; |
| 148 } | 147 } |
| 149 | 148 return rect_in_root_frame; |
| 150 return parent_rect; | |
| 151 } | 149 } |
| 152 | 150 |
| 153 DEFINE_TRACE(RemoteFrameView) { | 151 DEFINE_TRACE(RemoteFrameView) { |
| 154 visitor->Trace(remote_frame_); | 152 visitor->Trace(remote_frame_); |
| 155 visitor->Trace(parent_); | 153 visitor->Trace(parent_); |
| 156 } | 154 } |
| 157 | 155 |
| 158 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |