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/ResizeObserver.h" | 5 #include "core/dom/ResizeObserver.h" |
6 | 6 |
7 #include "core/dom/Element.h" | 7 #include "core/dom/Element.h" |
8 #include "core/dom/ResizeObservation.h" | 8 #include "core/dom/ResizeObservation.h" |
9 #include "core/dom/ResizeObserverCallback.h" | 9 #include "core/dom/ResizeObserverCallback.h" |
10 #include "core/dom/ResizeObserverController.h" | 10 #include "core/dom/ResizeObserverController.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void ResizeObserver::disconnect() { | 54 void ResizeObserver::disconnect() { |
55 ObservationList observations; | 55 ObservationList observations; |
56 m_observations.swap(observations); | 56 m_observations.swap(observations); |
57 | 57 |
58 for (auto& observation : observations) { | 58 for (auto& observation : observations) { |
59 Element* target = (*observation).target(); | 59 Element* target = (*observation).target(); |
60 if (target) | 60 if (target) |
61 target->ensureResizeObserverData().remove(this); | 61 target->ensureResizeObserverData().erase(this); |
62 } | 62 } |
63 clearObservations(); | 63 clearObservations(); |
64 } | 64 } |
65 | 65 |
66 size_t ResizeObserver::gatherObservations(size_t deeperThan) { | 66 size_t ResizeObserver::gatherObservations(size_t deeperThan) { |
67 DCHECK(m_activeObservations.isEmpty()); | 67 DCHECK(m_activeObservations.isEmpty()); |
68 | 68 |
69 size_t minObservedDepth = ResizeObserverController::kDepthBottom; | 69 size_t minObservedDepth = ResizeObserverController::kDepthBottom; |
70 if (!m_elementSizeChanged) | 70 if (!m_elementSizeChanged) |
71 return minObservedDepth; | 71 return minObservedDepth; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 DEFINE_TRACE(ResizeObserver) { | 118 DEFINE_TRACE(ResizeObserver) { |
119 visitor->trace(m_callback); | 119 visitor->trace(m_callback); |
120 visitor->trace(m_observations); | 120 visitor->trace(m_observations); |
121 visitor->trace(m_activeObservations); | 121 visitor->trace(m_activeObservations); |
122 visitor->trace(m_controller); | 122 visitor->trace(m_controller); |
123 } | 123 } |
124 | 124 |
125 } // namespace blink | 125 } // namespace blink |
OLD | NEW |