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 #include "core/dom/Element.h" |
8 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
9 #include "platform/tracing/TraceEvent.h" | 10 #include "platform/tracing/TraceEvent.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 IntersectionObserverController* IntersectionObserverController::create( | 14 IntersectionObserverController* IntersectionObserverController::create( |
14 Document* document) { | 15 Document* document) { |
15 IntersectionObserverController* result = | 16 IntersectionObserverController* result = |
16 new IntersectionObserverController(document); | 17 new IntersectionObserverController(document); |
17 result->suspendIfNeeded(); | 18 result->suspendIfNeeded(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 80 |
80 void IntersectionObserverController::addTrackedObserver( | 81 void IntersectionObserverController::addTrackedObserver( |
81 IntersectionObserver& observer) { | 82 IntersectionObserver& observer) { |
82 m_trackedIntersectionObservers.add(&observer); | 83 m_trackedIntersectionObservers.add(&observer); |
83 } | 84 } |
84 | 85 |
85 void IntersectionObserverController::removeTrackedObserversForRoot( | 86 void IntersectionObserverController::removeTrackedObserversForRoot( |
86 const Node& root) { | 87 const Node& root) { |
87 HeapVector<Member<IntersectionObserver>> toRemove; | 88 HeapVector<Member<IntersectionObserver>> toRemove; |
88 for (auto& observer : m_trackedIntersectionObservers) { | 89 for (auto& observer : m_trackedIntersectionObservers) { |
89 if (observer->rootNode() == &root) | 90 if (observer->root() == &root) |
90 toRemove.append(observer); | 91 toRemove.append(observer); |
91 } | 92 } |
92 m_trackedIntersectionObservers.removeAll(toRemove); | 93 m_trackedIntersectionObservers.removeAll(toRemove); |
93 } | 94 } |
94 | 95 |
95 DEFINE_TRACE(IntersectionObserverController) { | 96 DEFINE_TRACE(IntersectionObserverController) { |
96 visitor->trace(m_trackedIntersectionObservers); | 97 visitor->trace(m_trackedIntersectionObservers); |
97 visitor->trace(m_pendingIntersectionObservers); | 98 visitor->trace(m_pendingIntersectionObservers); |
98 ActiveDOMObject::trace(visitor); | 99 ActiveDOMObject::trace(visitor); |
99 } | 100 } |
100 | 101 |
101 } // namespace blink | 102 } // namespace blink |
OLD | NEW |