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 ASSERT(remote_frame); | 20 ASSERT(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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (parent_visible_ == visible) | 129 if (parent_visible_ == visible) |
131 return; | 130 return; |
132 | 131 |
133 parent_visible_ = visible; | 132 parent_visible_ = visible; |
134 if (!self_visible_) | 133 if (!self_visible_) |
135 return; | 134 return; |
136 | 135 |
137 remote_frame_->Client()->VisibilityChanged(self_visible_ && parent_visible_); | 136 remote_frame_->Client()->VisibilityChanged(self_visible_ && parent_visible_); |
138 } | 137 } |
139 | 138 |
140 IntRect RemoteFrameView::ConvertFromContainingFrameViewBase( | 139 IntRect RemoteFrameView::ConvertFromRootFrame( |
141 const IntRect& parent_rect) const { | 140 const IntRect& rect_in_root_frame) const { |
142 if (const FrameView* parent = ToFrameView(Parent())) { | 141 if (parent_) { |
143 IntRect local_rect = parent_rect; | 142 IntRect parent_rect = parent_->ConvertFromRootFrame(rect_in_root_frame); |
144 local_rect.SetLocation( | 143 parent_rect.SetLocation(parent_->ConvertSelfToChild( |
145 parent->ConvertSelfToChild(this, local_rect.Location())); | 144 frame_rect_.Location(), parent_rect.Location())); |
146 return local_rect; | 145 return parent_rect; |
147 } | 146 } |
148 | 147 return rect_in_root_frame; |
149 return parent_rect; | |
150 } | 148 } |
151 | 149 |
152 DEFINE_TRACE(RemoteFrameView) { | 150 DEFINE_TRACE(RemoteFrameView) { |
153 visitor->Trace(remote_frame_); | 151 visitor->Trace(remote_frame_); |
154 visitor->Trace(parent_); | 152 visitor->Trace(parent_); |
155 } | 153 } |
156 | 154 |
157 } // namespace blink | 155 } // namespace blink |
OLD | NEW |