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() { |