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 705a1bf4b3c529ff2b9d531f295e25f9658e7ff0..055c6f956ec22224c3c8f142a4fb242a28e23b90 100644 |
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.cpp |
@@ -25,6 +25,7 @@ IntersectionObservation::IntersectionObservation(IntersectionObserver& observer, |
void IntersectionObservation::initializeGeometry(IntersectionGeometry& geometry) |
{ |
+ ASSERT(m_target); |
LayoutObject* targetLayoutObject = m_target->layoutObject(); |
if (targetLayoutObject->isBoxModelObject()) |
geometry.targetRect = toLayoutBoxModelObject(targetLayoutObject)->visualOverflowRect(); |
@@ -37,6 +38,7 @@ void IntersectionObservation::clipToRoot(LayoutRect& rect) |
{ |
// Map and clip rect into root element coordinates. |
// TODO(szager): the writing mode flipping needs a test. |
+ ASSERT(m_target); |
LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
LayoutObject* targetLayoutObject = m_target->layoutObject(); |
targetLayoutObject->mapToVisibleRectInAncestorSpace(toLayoutBoxModelObject(rootLayoutObject), rect, nullptr); |
@@ -76,6 +78,7 @@ static void mapRectToDocumentCoordinates(LayoutObject& layoutObject, LayoutRect& |
bool IntersectionObservation::computeGeometry(IntersectionGeometry& geometry) |
{ |
+ ASSERT(m_target); |
LayoutObject* rootLayoutObject = m_observer->rootLayoutObject(); |
LayoutObject* targetLayoutObject = m_target->layoutObject(); |
if (!rootLayoutObject->isBoxModelObject()) |
@@ -145,10 +148,8 @@ void IntersectionObservation::computeIntersectionObservations(double timestamp) |
void IntersectionObservation::disconnect() |
{ |
- if (m_target) { |
+ if (m_target) |
m_target->ensureIntersectionObserverData().removeObservation(this->observer()); |
- m_target.clear(); |
- } |
m_observer->removeObservation(*this); |
m_observer.clear(); |
} |