| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/IntersectionObservation.h" | 5 #include "core/dom/IntersectionObservation.h" |
| 6 | 6 |
| 7 #include "core/dom/ElementRareData.h" | 7 #include "core/dom/ElementRareData.h" |
| 8 #include "core/dom/IntersectionObserver.h" | 8 #include "core/dom/IntersectionObserver.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 pixelSnappedIntRect(geometry.rootRect), | 154 pixelSnappedIntRect(geometry.rootRect), |
| 155 pixelSnappedIntRect(geometry.intersectionRect), | 155 pixelSnappedIntRect(geometry.intersectionRect), |
| 156 targetElement); | 156 targetElement); |
| 157 observer().enqueueIntersectionObserverEntry(*newEntry); | 157 observer().enqueueIntersectionObserverEntry(*newEntry); |
| 158 } | 158 } |
| 159 setLastThresholdIndex(newThresholdIndex); | 159 setLastThresholdIndex(newThresholdIndex); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void IntersectionObservation::disconnect() | 162 void IntersectionObservation::disconnect() |
| 163 { | 163 { |
| 164 IntersectionObserver* observer = m_observer; |
| 165 clearRootAndRemoveFromTarget(); |
| 166 observer->removeObservation(*this); |
| 167 } |
| 168 |
| 169 void IntersectionObservation::clearRootAndRemoveFromTarget() |
| 170 { |
| 164 if (m_target) | 171 if (m_target) |
| 165 target()->ensureIntersectionObserverData().removeObservation(this->obser
ver()); | 172 target()->ensureIntersectionObserverData().removeObservation(observer())
; |
| 166 m_observer->removeObservation(*this); | |
| 167 m_observer.clear(); | 173 m_observer.clear(); |
| 168 } | 174 } |
| 169 | 175 |
| 170 DEFINE_TRACE(IntersectionObservation) | 176 DEFINE_TRACE(IntersectionObservation) |
| 171 { | 177 { |
| 172 visitor->trace(m_observer); | 178 visitor->trace(m_observer); |
| 173 visitor->trace(m_target); | 179 visitor->trace(m_target); |
| 174 } | 180 } |
| 175 | 181 |
| 176 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |