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

Side by Side Diff: third_party/WebKit/Source/core/frame/RemoteFrameView.cpp

Issue 2860903003: Propagate viewport intersection across OOPIFs at the correct time (Closed)
Patch Set: DCHECK removed. Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteFrameView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return; 52 return;
53 53
54 // Start with rect in remote frame's coordinate space. Then 54 // Start with rect in remote frame's coordinate space. Then
55 // mapToVisualRectInAncestorSpace will move it to the local root's coordinate 55 // mapToVisualRectInAncestorSpace will move it to the local root's coordinate
56 // space and account for any clip from containing elements such as a 56 // space and account for any clip from containing elements such as a
57 // scrollable div. Passing nullptr as an argument to 57 // scrollable div. Passing nullptr as an argument to
58 // mapToVisualRectInAncestorSpace causes it to be clipped to the viewport, 58 // mapToVisualRectInAncestorSpace causes it to be clipped to the viewport,
59 // even if there are RemoteFrame ancestors in the frame tree. 59 // even if there are RemoteFrame ancestors in the frame tree.
60 LayoutRect rect(0, 0, frame_rect_.Width(), frame_rect_.Height()); 60 LayoutRect rect(0, 0, frame_rect_.Width(), frame_rect_.Height());
61 rect.Move(remote_frame_->OwnerLayoutObject()->ContentBoxOffset()); 61 rect.Move(remote_frame_->OwnerLayoutObject()->ContentBoxOffset());
62 if (!remote_frame_->OwnerLayoutObject()->MapToVisualRectInAncestorSpace( 62 IntRect viewport_intersection;
63 nullptr, rect)) 63 if (remote_frame_->OwnerLayoutObject()->MapToVisualRectInAncestorSpace(
64 return; 64 nullptr, rect)) {
65 IntRect root_visible_rect = local_root_view->VisibleContentRect(); 65 IntRect root_visible_rect = local_root_view->VisibleContentRect();
66 IntRect viewport_intersection(rect); 66 IntRect intersected_rect(rect);
67 viewport_intersection.Intersect(root_visible_rect); 67 intersected_rect.Intersect(root_visible_rect);
68 viewport_intersection.Move(-local_root_view->ScrollOffsetInt()); 68 intersected_rect.Move(-local_root_view->ScrollOffsetInt());
69 69
70 // Translate the intersection rect from the root frame's coordinate space 70 // Translate the intersection rect from the root frame's coordinate space
71 // to the remote frame's coordinate space. 71 // to the remote frame's coordinate space.
72 viewport_intersection = ConvertFromRootFrame(viewport_intersection); 72 viewport_intersection = ConvertFromRootFrame(intersected_rect);
73 }
74
73 if (viewport_intersection != last_viewport_intersection_) { 75 if (viewport_intersection != last_viewport_intersection_) {
74 remote_frame_->Client()->UpdateRemoteViewportIntersection( 76 remote_frame_->Client()->UpdateRemoteViewportIntersection(
75 viewport_intersection); 77 viewport_intersection);
76 } 78 }
79
77 last_viewport_intersection_ = viewport_intersection; 80 last_viewport_intersection_ = viewport_intersection;
78 } 81 }
79 82
80 void RemoteFrameView::Dispose() { 83 void RemoteFrameView::Dispose() {
81 HTMLFrameOwnerElement* owner_element = remote_frame_->DeprecatedLocalOwner(); 84 HTMLFrameOwnerElement* owner_element = remote_frame_->DeprecatedLocalOwner();
82 // ownerElement can be null during frame swaps, because the 85 // ownerElement can be null during frame swaps, because the
83 // RemoteFrameView is disconnected before detachment. 86 // RemoteFrameView is disconnected before detachment.
84 if (owner_element && owner_element->OwnedWidget() == this) 87 if (owner_element && owner_element->OwnedWidget() == this)
85 owner_element->SetWidget(nullptr); 88 owner_element->SetWidget(nullptr);
86 } 89 }
(...skipping 18 matching lines...) Expand all
105 } 108 }
106 109
107 void RemoteFrameView::FrameRectsChanged() { 110 void RemoteFrameView::FrameRectsChanged() {
108 // Update the rect to reflect the position of the frame relative to the 111 // Update the rect to reflect the position of the frame relative to the
109 // containing local frame root. The position of the local root within 112 // containing local frame root. The position of the local root within
110 // any remote frames, if any, is accounted for by the embedder. 113 // any remote frames, if any, is accounted for by the embedder.
111 IntRect new_rect = frame_rect_; 114 IntRect new_rect = frame_rect_;
112 if (parent_) 115 if (parent_)
113 new_rect = parent_->ConvertToRootFrame(parent_->ContentsToFrame(new_rect)); 116 new_rect = parent_->ConvertToRootFrame(parent_->ContentsToFrame(new_rect));
114 remote_frame_->Client()->FrameRectsChanged(new_rect); 117 remote_frame_->Client()->FrameRectsChanged(new_rect);
115
116 UpdateRemoteViewportIntersection();
117 } 118 }
118 119
119 void RemoteFrameView::Hide() { 120 void RemoteFrameView::Hide() {
120 self_visible_ = false; 121 self_visible_ = false;
121 remote_frame_->Client()->VisibilityChanged(false); 122 remote_frame_->Client()->VisibilityChanged(false);
122 } 123 }
123 124
124 void RemoteFrameView::Show() { 125 void RemoteFrameView::Show() {
125 self_visible_ = true; 126 self_visible_ = true;
126 remote_frame_->Client()->VisibilityChanged(true); 127 remote_frame_->Client()->VisibilityChanged(true);
(...skipping 21 matching lines...) Expand all
148 149
149 return parent_rect; 150 return parent_rect;
150 } 151 }
151 152
152 DEFINE_TRACE(RemoteFrameView) { 153 DEFINE_TRACE(RemoteFrameView) {
153 visitor->Trace(remote_frame_); 154 visitor->Trace(remote_frame_);
154 visitor->Trace(parent_); 155 visitor->Trace(parent_);
155 } 156 }
156 157
157 } // namespace blink 158 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteFrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698