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

Unified Diff: third_party/WebKit/Source/core/frame/RemoteFrameView.cpp

Issue 2431473003: Intersection Observer support for OOPIF (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
index d73ac0a12b1be30a510ebefa50124bbe42f465bd..f418ffd77932919d1221d80d455ad3fd50670000 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/RemoteFrameView.cpp
@@ -5,9 +5,12 @@
#include "core/frame/RemoteFrameView.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
#include "core/frame/RemoteFrame.h"
+#include "core/frame/RemoteFrameClient.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/layout/api/LayoutPartItem.h"
+#include "platform/geometry/IntPoint.h"
namespace blink {
@@ -29,6 +32,36 @@ RemoteFrameView* RemoteFrameView::create(RemoteFrame* remoteFrame) {
return view;
}
+void RemoteFrameView::updateRemoteViewportIntersection() {
+ if (!m_remoteFrame->tree().parent() ||
+ !m_remoteFrame->tree().parent()->isLocalFrame() ||
+ !m_remoteFrame->client())
+ return;
+
+ FrameView* parent = toLocalFrame(m_remoteFrame->tree().parent())->view();
+ if (!parent)
+ return;
+
+ // TODO(kenrb): I don't think this works with nested OOPIFs. We need to take
+ // the local frame root's rootOffset into account to get actual viewport pos.
+ IntRect viewportIntersection = parent->contentsToRootFrame(frameRect());
szager1 2016/10/24 16:54:52 I don't think this is right, because parentsToRoot
kenrb 2016/10/28 18:51:56 Done.
+ IntPoint rootOffset(viewportIntersection.x(), viewportIntersection.y());
+
+ IntRect parentViewportIntersection = parent->viewportIntersection();
+ if (parentViewportIntersection.isEmpty()) {
+ m_remoteFrame->client()->updateRemoteViewportIntersection(
+ parentViewportIntersection, rootOffset);
+ return;
+ }
+
+ viewportIntersection.intersect(parentViewportIntersection);
+ if (viewportIntersection != m_lastViewportIntersection) {
+ m_remoteFrame->client()->updateRemoteViewportIntersection(
+ viewportIntersection, rootOffset);
+ }
+ m_lastViewportIntersection = viewportIntersection;
+}
+
void RemoteFrameView::dispose() {
HTMLFrameOwnerElement* ownerElement = m_remoteFrame->deprecatedLocalOwner();
// ownerElement can be null during frame swaps, because the
@@ -68,7 +101,9 @@ void RemoteFrameView::frameRectsChanged() {
if (parent() && parent()->isFrameView())
newRect = parent()->convertToRootFrame(
toFrameView(parent())->contentsToFrame(newRect));
- m_remoteFrame->frameRectsChanged(newRect);
+ m_remoteFrame->client()->frameRectsChanged(newRect);
+
+ updateRemoteViewportIntersection();
}
void RemoteFrameView::hide() {
@@ -76,7 +111,8 @@ void RemoteFrameView::hide() {
Widget::hide();
- m_remoteFrame->visibilityChanged(false);
+ if (m_remoteFrame->client())
+ m_remoteFrame->client()->visibilityChanged(false);
}
void RemoteFrameView::show() {
@@ -84,7 +120,8 @@ void RemoteFrameView::show() {
Widget::show();
- m_remoteFrame->visibilityChanged(true);
+ if (m_remoteFrame->client())
+ m_remoteFrame->client()->visibilityChanged(true);
}
void RemoteFrameView::setParentVisible(bool visible) {
@@ -95,7 +132,8 @@ void RemoteFrameView::setParentVisible(bool visible) {
if (!isSelfVisible())
return;
- m_remoteFrame->visibilityChanged(isVisible());
+ if (m_remoteFrame->client())
+ m_remoteFrame->client()->visibilityChanged(isVisible());
}
DEFINE_TRACE(RemoteFrameView) {
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteFrameView.h ('k') | third_party/WebKit/Source/web/RemoteFrameClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698