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/NodeIntersectionObserverData.h" | 5 #include "core/dom/NodeIntersectionObserverData.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" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 NodeIntersectionObserverData::NodeIntersectionObserverData() { } | 14 NodeIntersectionObserverData::NodeIntersectionObserverData() { } |
15 | 15 |
16 NodeIntersectionObserverData::~NodeIntersectionObserverData() { } | 16 NodeIntersectionObserverData::~NodeIntersectionObserverData() { } |
17 | 17 |
18 bool NodeIntersectionObserverData::hasIntersectionObserver() const | |
19 { | |
20 return !m_intersectionObservers.isEmpty(); | |
21 } | |
22 | |
23 bool NodeIntersectionObserverData::hasIntersectionObservation() const | |
24 { | |
25 return !m_intersectionObservations.isEmpty(); | |
26 } | |
27 | |
28 IntersectionObservation* NodeIntersectionObserverData::getObservationFor(Interse
ctionObserver& observer) | 18 IntersectionObservation* NodeIntersectionObserverData::getObservationFor(Interse
ctionObserver& observer) |
29 { | 19 { |
30 auto i = m_intersectionObservations.find(&observer); | 20 auto i = m_intersectionObservations.find(&observer); |
31 if (i == m_intersectionObservations.end()) | 21 if (i == m_intersectionObservations.end()) |
32 return nullptr; | 22 return nullptr; |
33 return i->value; | 23 return i->value; |
34 } | 24 } |
35 | 25 |
36 void NodeIntersectionObserverData::addObservation(IntersectionObservation& obser
vation) | 26 void NodeIntersectionObserverData::addObservation(IntersectionObservation& obser
vation) |
37 { | 27 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #endif | 69 #endif |
80 } | 70 } |
81 | 71 |
82 DEFINE_TRACE(NodeIntersectionObserverData) | 72 DEFINE_TRACE(NodeIntersectionObserverData) |
83 { | 73 { |
84 visitor->trace(m_intersectionObservers); | 74 visitor->trace(m_intersectionObservers); |
85 visitor->trace(m_intersectionObservations); | 75 visitor->trace(m_intersectionObservations); |
86 } | 76 } |
87 | 77 |
88 } // namespace blink | 78 } // namespace blink |
OLD | NEW |