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

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

Issue 1570413002: Get rid of unnecessary weak pointer cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add ASSERT(m_target) where appropriate 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698