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 29 matching lines...) Expand all Loading... |
40 frameView->scheduleAnimation(); | 40 frameView->scheduleAnimation(); |
41 } | 41 } |
42 | 42 |
43 void ResizeObserver::unobserve(Element* target) { | 43 void ResizeObserver::unobserve(Element* target) { |
44 auto observerMap = target ? target->resizeObserverData() : nullptr; | 44 auto observerMap = target ? target->resizeObserverData() : nullptr; |
45 if (!observerMap) | 45 if (!observerMap) |
46 return; | 46 return; |
47 auto observation = observerMap->find(this); | 47 auto observation = observerMap->find(this); |
48 if (observation != observerMap->end()) { | 48 if (observation != observerMap->end()) { |
49 m_observations.erase((*observation).value); | 49 m_observations.erase((*observation).value); |
50 observerMap->remove(observation); | 50 observerMap->erase(observation); |
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) |
(...skipping 55 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 |