| 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" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 FrameViewBase::SetFrameRect(new_rect); | 97 FrameViewBase::SetFrameRect(new_rect); |
| 98 | 98 |
| 99 FrameRectsChanged(); | 99 FrameRectsChanged(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void RemoteFrameView::FrameRectsChanged() { | 102 void RemoteFrameView::FrameRectsChanged() { |
| 103 // Update the rect to reflect the position of the frame relative to the | 103 // Update the rect to reflect the position of the frame relative to the |
| 104 // containing local frame root. The position of the local root within | 104 // containing local frame root. The position of the local root within |
| 105 // any remote frames, if any, is accounted for by the embedder. | 105 // any remote frames, if any, is accounted for by the embedder. |
| 106 IntRect new_rect = FrameRect(); | 106 IntRect new_rect = FrameRect(); |
| 107 if (Parent() && Parent()->IsFrameView()) | 107 if (const FrameView* parent = ToFrameView(Parent())) |
| 108 new_rect = Parent()->ConvertToRootFrame( | 108 new_rect = parent->ConvertToRootFrame(parent->ContentsToFrame(new_rect)); |
| 109 ToFrameView(Parent())->ContentsToFrame(new_rect)); | 109 |
| 110 remote_frame_->Client()->FrameRectsChanged(new_rect); | 110 remote_frame_->Client()->FrameRectsChanged(new_rect); |
| 111 | 111 |
| 112 UpdateRemoteViewportIntersection(); | 112 UpdateRemoteViewportIntersection(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void RemoteFrameView::Hide() { | 115 void RemoteFrameView::Hide() { |
| 116 SetSelfVisible(false); | 116 SetSelfVisible(false); |
| 117 | 117 |
| 118 remote_frame_->Client()->VisibilityChanged(false); | 118 remote_frame_->Client()->VisibilityChanged(false); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void RemoteFrameView::Show() { | 121 void RemoteFrameView::Show() { |
| 122 SetSelfVisible(true); | 122 SetSelfVisible(true); |
| 123 | 123 |
| 124 remote_frame_->Client()->VisibilityChanged(true); | 124 remote_frame_->Client()->VisibilityChanged(true); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void RemoteFrameView::SetParentVisible(bool visible) { | 127 void RemoteFrameView::SetParentVisible(bool visible) { |
| 128 if (IsParentVisible() == visible) | 128 if (IsParentVisible() == visible) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 FrameViewBase::SetParentVisible(visible); | 131 FrameViewBase::SetParentVisible(visible); |
| 132 if (!IsSelfVisible()) | 132 if (!IsSelfVisible()) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 remote_frame_->Client()->VisibilityChanged(IsVisible()); | 135 remote_frame_->Client()->VisibilityChanged(IsVisible()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 IntRect RemoteFrameView::ConvertFromContainingFrameViewBase( |
| 139 const IntRect& parent_rect) const { |
| 140 if (const FrameView* parent = ToFrameView(Parent())) { |
| 141 IntRect local_rect = parent_rect; |
| 142 local_rect.SetLocation( |
| 143 parent->ConvertSelfToChild(this, local_rect.Location())); |
| 144 return local_rect; |
| 145 } |
| 146 |
| 147 return parent_rect; |
| 148 } |
| 149 |
| 138 DEFINE_TRACE(RemoteFrameView) { | 150 DEFINE_TRACE(RemoteFrameView) { |
| 139 visitor->Trace(remote_frame_); | 151 visitor->Trace(remote_frame_); |
| 140 FrameViewBase::Trace(visitor); | 152 FrameViewBase::Trace(visitor); |
| 141 } | 153 } |
| 142 | 154 |
| 143 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |