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/IntersectionObserverController.h" | 5 #include "core/dom/IntersectionObserverController.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 double timestamp = currentTime(); | 40 double timestamp = currentTime(); |
41 for (auto& observer : m_trackedIntersectionObservers) | 41 for (auto& observer : m_trackedIntersectionObservers) |
42 observer->computeIntersectionObservations(timestamp); | 42 observer->computeIntersectionObservations(timestamp); |
43 } | 43 } |
44 | 44 |
45 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob
server) | 45 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob
server) |
46 { | 46 { |
47 m_trackedIntersectionObservers.add(&observer); | 47 m_trackedIntersectionObservers.add(&observer); |
48 } | 48 } |
49 | 49 |
50 void IntersectionObserverController::removeTrackedObserversForRoot(const Element
& root) | 50 void IntersectionObserverController::removeTrackedObserversForRoot(const Node& r
oot) |
51 { | 51 { |
52 HeapVector<Member<IntersectionObserver>> toRemove; | 52 HeapVector<Member<IntersectionObserver>> toRemove; |
53 for (auto& observer : m_trackedIntersectionObservers) { | 53 for (auto& observer : m_trackedIntersectionObservers) { |
54 if (observer->root() == &root) | 54 if (observer->root() == &root) |
55 toRemove.append(observer); | 55 toRemove.append(observer); |
56 } | 56 } |
57 m_trackedIntersectionObservers.removeAll(toRemove); | 57 m_trackedIntersectionObservers.removeAll(toRemove); |
58 } | 58 } |
59 | 59 |
60 DEFINE_TRACE(IntersectionObserverController) | 60 DEFINE_TRACE(IntersectionObserverController) |
61 { | 61 { |
62 visitor->trace(m_trackedIntersectionObservers); | 62 visitor->trace(m_trackedIntersectionObservers); |
63 visitor->trace(m_pendingIntersectionObservers); | 63 visitor->trace(m_pendingIntersectionObservers); |
64 } | 64 } |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
OLD | NEW |