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

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

Issue 1615573002: Set rootBounds to null for cross-origin observations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Get rid of js-test.js monkey patching Created 4 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/dom/IntersectionObservation.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
index a32edd7be70bcdf562207bb7a3100af44988a3d6..8c184459ef05d91311b8174b0ca6055cf101e492 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
@@ -116,8 +116,6 @@ bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry)
if (geometry.intersectionRect.size().isZero())
geometry.intersectionRect = LayoutRect();
- if (!m_shouldReportRootBounds)
- geometry.rootRect = LayoutRect();
return true;
}
@@ -147,11 +145,13 @@ void IntersectionObservation::computeIntersectionObservations(double timestamp)
return;
float newVisibleRatio = intersectionArea / targetArea;
unsigned newThresholdIndex = observer().firstThresholdGreaterThan(newVisibleRatio);
+ IntRect snappedRootBounds = pixelSnappedIntRect(geometry.rootRect);
+ IntRect* rootBoundsPointer = m_shouldReportRootBounds ? &snappedRootBounds : nullptr;
if (m_lastThresholdIndex != newThresholdIndex) {
IntersectionObserverEntry* newEntry = new IntersectionObserverEntry(
timestamp / 1000.0,
pixelSnappedIntRect(geometry.targetRect),
- pixelSnappedIntRect(geometry.rootRect),
+ rootBoundsPointer,
pixelSnappedIntRect(geometry.intersectionRect),
targetElement);
observer().enqueueIntersectionObserverEntry(*newEntry);

Powered by Google App Engine
This is Rietveld 408576698