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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObservation.cpp

Issue 2203123004: Don't adjust for scrolling of the ancestor, rather than un-adjusting for it later. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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/dom/IntersectionObservation.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
index 39821a7a7755560f04cd10ee74856060e19bfca9..ea0cd1fdb901526599b6079bffe44a3c156f5c7a 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
@@ -61,14 +61,17 @@ void IntersectionObservation::clipToRoot(IntersectionGeometry& geometry) const
// Map and clip rect into root element coordinates.
// TODO(szager): the writing mode flipping needs a test.
DCHECK(m_target);
- LayoutObject* rootLayoutObject = m_observer->rootLayoutObject();
+ LayoutBox* rootLayoutObject = toLayoutBox(m_observer->rootLayoutObject());
LayoutObject* targetLayoutObject = target()->layoutObject();
- geometry.doesIntersect = targetLayoutObject->mapToVisualRectInAncestorSpace(toLayoutBoxModelObject(rootLayoutObject), geometry.intersectionRect, EdgeInclusive);
+ geometry.doesIntersect = targetLayoutObject->mapToVisualRectInAncestorSpace(rootLayoutObject, geometry.intersectionRect, EdgeInclusive);
+ if (rootLayoutObject->hasOverflowClip())
+ geometry.intersectionRect.move(-rootLayoutObject->scrolledContentOffset());
+
if (!geometry.doesIntersect)
return;
LayoutRect rootClipRect(geometry.rootRect);
- toLayoutBox(rootLayoutObject)->flipForWritingMode(rootClipRect);
+ rootLayoutObject->flipForWritingMode(rootClipRect);
geometry.doesIntersect &= geometry.intersectionRect.inclusiveIntersect(rootClipRect);
}

Powered by Google App Engine
This is Rietveld 408576698