| 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 6effa417267e0b7dccc07f47e5e18038624b8b15..2d55282406f2ccc17586036c1e09d555105236ff 100644
|
| --- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp
|
| @@ -20,6 +20,7 @@ IntersectionObservation::IntersectionObservation(IntersectionObserver& observer,
|
|
|
| void IntersectionObservation::computeIntersectionObservations(
|
| DOMHighResTimeStamp timestamp) {
|
| + DCHECK(observer());
|
| if (!m_target)
|
| return;
|
| Vector<Length> rootMargin(4);
|
| @@ -57,7 +58,7 @@ void IntersectionObservation::computeIntersectionObservations(
|
| geometry.targetRect().size().height().toFloat();
|
| newVisibleRatio = intersectionArea / targetArea;
|
| }
|
| - newThresholdIndex = observer().firstThresholdGreaterThan(newVisibleRatio);
|
| + newThresholdIndex = observer()->firstThresholdGreaterThan(newVisibleRatio);
|
| } else {
|
| newVisibleRatio = 0;
|
| newThresholdIndex = 0;
|
| @@ -69,20 +70,15 @@ void IntersectionObservation::computeIntersectionObservations(
|
| IntersectionObserverEntry* newEntry = new IntersectionObserverEntry(
|
| timestamp, newVisibleRatio, geometry.targetIntRect(), rootBoundsPointer,
|
| geometry.intersectionIntRect(), target());
|
| - observer().enqueueIntersectionObserverEntry(*newEntry);
|
| + observer()->enqueueIntersectionObserverEntry(*newEntry);
|
| setLastThresholdIndex(newThresholdIndex);
|
| }
|
| }
|
|
|
| void IntersectionObservation::disconnect() {
|
| - IntersectionObserver* observer = m_observer;
|
| - clearRootAndRemoveFromTarget();
|
| - observer->removeObservation(*this);
|
| -}
|
| -
|
| -void IntersectionObservation::clearRootAndRemoveFromTarget() {
|
| + DCHECK(observer());
|
| if (m_target)
|
| - target()->ensureIntersectionObserverData().removeObservation(observer());
|
| + target()->ensureIntersectionObserverData().removeObservation(*observer());
|
| m_observer.clear();
|
| }
|
|
|
|
|