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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (observer->hasEntries()) | 68 if (observer->hasEntries()) |
69 scheduleIntersectionObserverForDelivery(*observer); | 69 scheduleIntersectionObserverForDelivery(*observer); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob
server) | 73 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob
server) |
74 { | 74 { |
75 m_trackedIntersectionObservers.add(&observer); | 75 m_trackedIntersectionObservers.add(&observer); |
76 } | 76 } |
77 | 77 |
78 void IntersectionObserverController::removeTrackedObserversForRoot(const Element
& root) | 78 void IntersectionObserverController::removeTrackedObserversForRoot(const Node& r
oot) |
79 { | 79 { |
80 HeapVector<Member<IntersectionObserver>> toRemove; | 80 HeapVector<Member<IntersectionObserver>> toRemove; |
81 for (auto& observer : m_trackedIntersectionObservers) { | 81 for (auto& observer : m_trackedIntersectionObservers) { |
82 if (observer->root() == &root) | 82 if (observer->root() == &root) |
83 toRemove.append(observer); | 83 toRemove.append(observer); |
84 } | 84 } |
85 m_trackedIntersectionObservers.removeAll(toRemove); | 85 m_trackedIntersectionObservers.removeAll(toRemove); |
86 } | 86 } |
87 | 87 |
88 DEFINE_TRACE(IntersectionObserverController) | 88 DEFINE_TRACE(IntersectionObserverController) |
89 { | 89 { |
90 visitor->trace(m_trackedIntersectionObservers); | 90 visitor->trace(m_trackedIntersectionObservers); |
91 visitor->trace(m_pendingIntersectionObservers); | 91 visitor->trace(m_pendingIntersectionObservers); |
92 ActiveDOMObject::trace(visitor); | 92 ActiveDOMObject::trace(visitor); |
93 } | 93 } |
94 | 94 |
95 } // namespace blink | 95 } // namespace blink |
OLD | NEW |