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 1f06da2f7f20b48a858b902738a2a7bf00991ed3..a32edd7be70bcdf562207bb7a3100af44988a3d6 100644 |
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
@@ -161,9 +161,15 @@ void IntersectionObservation::computeIntersectionObservations(double timestamp) |
void IntersectionObservation::disconnect() |
{ |
+ IntersectionObserver* observer = m_observer; |
+ clearRootAndRemoveFromTarget(); |
+ observer->removeObservation(*this); |
+} |
+ |
+void IntersectionObservation::clearRootAndRemoveFromTarget() |
+{ |
if (m_target) |
- target()->ensureIntersectionObserverData().removeObservation(this->observer()); |
- m_observer->removeObservation(*this); |
+ target()->ensureIntersectionObserverData().removeObservation(observer()); |
m_observer.clear(); |
} |