| 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/IntersectionObserver.h" | 5 #include "core/dom/IntersectionObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
| 9 #include "core/css/parser/CSSTokenizer.h" | 9 #include "core/css/parser/CSSTokenizer.h" |
| 10 #include "core/dom/ElementIntersectionObserverData.h" | 10 #include "core/dom/ElementIntersectionObserverData.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 observation->computeIntersectionObservations(timestamp); | 153 observation->computeIntersectionObservations(timestamp); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void IntersectionObserver::disconnect() | 156 void IntersectionObserver::disconnect() |
| 157 { | 157 { |
| 158 HeapVector<Member<IntersectionObservation>> observationsToDisconnect; | 158 HeapVector<Member<IntersectionObservation>> observationsToDisconnect; |
| 159 copyToVector(m_observations, observationsToDisconnect); | 159 copyToVector(m_observations, observationsToDisconnect); |
| 160 for (auto& observation : observationsToDisconnect) | 160 for (auto& observation : observationsToDisconnect) |
| 161 observation->disconnect(); | 161 observation->disconnect(); |
| 162 ASSERT(m_observations.isEmpty()); | 162 ASSERT(m_observations.isEmpty()); |
| 163 m_root.clear(); | |
| 164 } | 163 } |
| 165 | 164 |
| 166 void IntersectionObserver::removeObservation(IntersectionObservation& observatio
n) | 165 void IntersectionObserver::removeObservation(IntersectionObservation& observatio
n) |
| 167 { | 166 { |
| 168 m_observations.remove(&observation); | 167 m_observations.remove(&observation); |
| 169 } | 168 } |
| 170 | 169 |
| 171 HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords(
) | 170 HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords(
) |
| 172 { | 171 { |
| 173 checkRootAndDetachIfNeeded(); | 172 checkRootAndDetachIfNeeded(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 227 |
| 229 DEFINE_TRACE(IntersectionObserver) | 228 DEFINE_TRACE(IntersectionObserver) |
| 230 { | 229 { |
| 231 visitor->trace(m_callback); | 230 visitor->trace(m_callback); |
| 232 visitor->trace(m_root); | 231 visitor->trace(m_root); |
| 233 visitor->trace(m_observations); | 232 visitor->trace(m_observations); |
| 234 visitor->trace(m_entries); | 233 visitor->trace(m_entries); |
| 235 } | 234 } |
| 236 | 235 |
| 237 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |