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

Unified Diff: third_party/WebKit/Source/core/layout/IntersectionGeometry.cpp

Issue 2431473003: Intersection Observer support for OOPIF (Closed)
Patch Set: dcheng comments addressed Created 3 years, 11 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/layout/IntersectionGeometry.cpp
diff --git a/third_party/WebKit/Source/core/layout/IntersectionGeometry.cpp b/third_party/WebKit/Source/core/layout/IntersectionGeometry.cpp
index 82748795852b8929bbfad0479d639b5c460d33d3..d8c9a89e8c3220de2a78f31e957731e868846029 100644
--- a/third_party/WebKit/Source/core/layout/IntersectionGeometry.cpp
+++ b/third_party/WebKit/Source/core/layout/IntersectionGeometry.cpp
@@ -109,13 +109,10 @@ void IntersectionGeometry::initializeTargetRect() {
}
void IntersectionGeometry::initializeRootRect() {
- // TODO(szager): In OOPIF, m_root will be the LayoutView of the
- // localFrameRoot(). Once viewport intersection support lands,
- // add a call to mapToVisualRectInAncestorSpace to map the rect up to
- // top-level frame coordinates.
if (m_root->isLayoutView()) {
m_rootRect =
LayoutRect(toLayoutView(m_root)->frameView()->visibleContentRect());
+ m_root->mapToVisualRectInAncestorSpace(nullptr, m_rootRect);
} else if (m_root->isBox() && m_root->hasOverflowClip()) {
m_rootRect = LayoutRect(toLayoutBox(m_root)->contentBoxRect());
} else {
@@ -145,11 +142,10 @@ void IntersectionGeometry::applyRootMargin() {
void IntersectionGeometry::clipToRoot() {
// Map and clip rect into root element coordinates.
// TODO(szager): the writing mode flipping needs a test.
- // TODO(szager): Once the OOPIF viewport intersection code lands,
- // use nullptr for ancestor to map to the top frame.
LayoutBox* ancestor = toLayoutBox(m_root);
m_doesIntersect = m_target->mapToVisualRectInAncestorSpace(
- ancestor, m_intersectionRect, EdgeInclusive);
+ (rootIsImplicit() ? nullptr : ancestor), m_intersectionRect,
+ EdgeInclusive);
if (ancestor && ancestor->hasOverflowClip())
m_intersectionRect.move(-ancestor->scrolledContentOffset());
if (!m_doesIntersect)
@@ -169,14 +165,10 @@ void IntersectionGeometry::mapTargetRectToTargetFrameCoordinates() {
}
void IntersectionGeometry::mapRootRectToRootFrameCoordinates() {
- Document& rootDocument = m_root->document();
- if (!rootIsImplicit())
- mapRectUpToDocument(m_rootRect, *m_root, rootDocument);
- // TODO(szager): When OOPIF support lands, this scroll offset adjustment
- // will probably be wrong.
- LayoutSize scrollPosition =
- LayoutSize(rootDocument.view()->getScrollOffset());
- m_rootRect.move(-scrollPosition);
+ m_root->frameView()->mapQuadToAncestorFrameIncludingScrollOffset(
+ m_rootRect, m_root,
+ rootIsImplicit() ? nullptr : m_root->document().layoutView(),
+ UseTransforms | ApplyContainerFlip);
}
void IntersectionGeometry::mapIntersectionRectToTargetFrameCoordinates() {
« no previous file with comments | « third_party/WebKit/Source/core/frame/RemoteFrameView.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698