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/ElementIntersectionObserverData.h" | 5 #include "core/dom/ElementIntersectionObserverData.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/IntersectionObservation.h" | 8 #include "core/dom/IntersectionObservation.h" |
9 #include "core/dom/IntersectionObserver.h" | 9 #include "core/dom/IntersectionObserver.h" |
10 #include "core/dom/IntersectionObserverController.h" | 10 #include "core/dom/IntersectionObserverController.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 void ElementIntersectionObserverData::addObservation( | 34 void ElementIntersectionObserverData::addObservation( |
35 IntersectionObservation& observation) { | 35 IntersectionObservation& observation) { |
36 DCHECK(observation.observer()); | 36 DCHECK(observation.observer()); |
37 m_intersectionObservations.add( | 37 m_intersectionObservations.add( |
38 TraceWrapperMember<IntersectionObserver>(this, observation.observer()), | 38 TraceWrapperMember<IntersectionObserver>(this, observation.observer()), |
39 &observation); | 39 &observation); |
40 } | 40 } |
41 | 41 |
42 void ElementIntersectionObserverData::removeObservation( | 42 void ElementIntersectionObserverData::removeObservation( |
43 IntersectionObserver& observer) { | 43 IntersectionObserver& observer) { |
44 m_intersectionObservations.remove(&observer); | 44 m_intersectionObservations.erase(&observer); |
45 } | 45 } |
46 | 46 |
47 void ElementIntersectionObserverData::activateValidIntersectionObservers( | 47 void ElementIntersectionObserverData::activateValidIntersectionObservers( |
48 Node& node) { | 48 Node& node) { |
49 for (auto& observer : m_intersectionObservers) { | 49 for (auto& observer : m_intersectionObservers) { |
50 observer->trackingDocument() | 50 observer->trackingDocument() |
51 .ensureIntersectionObserverController() | 51 .ensureIntersectionObserverController() |
52 .addTrackedObserver(*observer); | 52 .addTrackedObserver(*observer); |
53 } | 53 } |
54 } | 54 } |
(...skipping 15 matching lines...) Expand all Loading... |
70 visitor->trace(m_intersectionObservations); | 70 visitor->trace(m_intersectionObservations); |
71 } | 71 } |
72 | 72 |
73 DEFINE_TRACE_WRAPPERS(ElementIntersectionObserverData) { | 73 DEFINE_TRACE_WRAPPERS(ElementIntersectionObserverData) { |
74 for (auto& entry : m_intersectionObservations) { | 74 for (auto& entry : m_intersectionObservations) { |
75 visitor->traceWrappers(entry.key); | 75 visitor->traceWrappers(entry.key); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
OLD | NEW |