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

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

Issue 2431473003: Intersection Observer support for OOPIF (Closed)
Patch Set: Rebase only Created 3 years, 12 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/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 7befa59cab9596c4259b88f2b9181b14a778f3c7..28906393f417f55c4f49ee79b8713e4597f0e374 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -52,6 +52,8 @@
#include "core/frame/Location.h"
#include "core/frame/PageScaleConstraintsSet.h"
#include "core/frame/PerformanceMonitor.h"
+#include "core/frame/RemoteFrame.h"
+#include "core/frame/RemoteFrameView.h"
#include "core/frame/Settings.h"
#include "core/frame/VisualViewport.h"
#include "core/html/HTMLFrameElement.h"
@@ -197,6 +199,7 @@ FrameView::FrameView(LocalFrame& frame)
m_needsScrollbarsUpdate(false),
m_suppressAdjustViewSize(false),
m_allowsLayoutInvalidationAfterLayoutClean(true),
+ m_remoteViewportIntersection(0, 0, 0, 0),
dcheng 2017/01/05 07:10:19 Nit: omit this, as the default constructor does th
kenrb 2017/01/09 19:31:20 Done.
m_mainThreadScrollingReasons(0),
m_mainThreadScrollingReasonsCounter(
MainThreadScrollingReason::kMainThreadScrollingReasonCount,
@@ -4908,4 +4911,40 @@ FrameView::getStyleRelatedMainThreadScrollingReasons() const {
return reasons;
}
+void FrameView::setViewportIntersectionFromParent(
+ const IntRect& viewportIntersection) {
+ if (m_remoteViewportIntersection != viewportIntersection) {
+ m_remoteViewportIntersection = viewportIntersection;
+ scheduleAnimation();
+ }
+}
+
+IntRect FrameView::remoteViewportIntersection() {
+ IntRect intersection(m_remoteViewportIntersection);
+ intersection.move(scrollOffsetInt());
+ return intersection;
+}
+
+void FrameView::mapQuadToAncestorFrameIncludingScrollOffset(
+ LayoutRect& rect,
+ const LayoutObject* descendant,
+ const LayoutView* ancestor,
+ MapCoordinatesFlags mode) {
+ FloatQuad mappedQuad = descendant->localToAncestorQuad(
+ FloatQuad(FloatRect(rect)), ancestor, mode);
+ rect = LayoutRect(mappedQuad.boundingBox());
+
+ // localToAncestorQuad accounts for scroll offset if it encounters a remote
+ // frame in the ancestor chain, otherwise it needs to be added explicitly.
+ if (frame().localFrameRoot() == frame().tree().top() ||
+ (ancestor &&
+ ancestor->frame()->localFrameRoot() == frame().localFrameRoot())) {
+ FrameView* ancestorView =
+ (ancestor ? ancestor->frameView()
+ : toLocalFrame(frame().tree().top())->view());
+ LayoutSize scrollPosition = LayoutSize(ancestorView->getScrollOffset());
+ rect.move(-scrollPosition);
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698