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 #ifndef IntersectionObservation_h | 5 #ifndef IntersectionObservation_h |
6 #define IntersectionObservation_h | 6 #define IntersectionObservation_h |
7 | 7 |
8 #include "core/dom/DOMHighResTimeStamp.h" | 8 #include "core/dom/DOMHighResTimeStamp.h" |
9 #include "core/dom/IntersectionGeometry.h" | |
10 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 class Element; | 13 class Element; |
15 class IntersectionObserver; | 14 class IntersectionObserver; |
16 | 15 |
17 class IntersectionObservation final | 16 class IntersectionObservation final |
18 : public GarbageCollected<IntersectionObservation> { | 17 : public GarbageCollected<IntersectionObservation> { |
19 public: | 18 public: |
20 IntersectionObservation( | 19 IntersectionObservation(IntersectionObserver&, |
21 IntersectionObserver&, | 20 Element&, |
22 Element&, | 21 bool shouldReportRootBounds); |
23 IntersectionGeometry::ReportRootBounds shouldReportRootBounds); | |
24 | 22 |
25 IntersectionObserver& observer() const { return *m_observer; } | 23 IntersectionObserver& observer() const { return *m_observer; } |
26 Element* target() const { return m_target; } | 24 Element* target() const { return m_target; } |
27 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | 25 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
28 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | 26 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
29 void computeIntersectionObservations(DOMHighResTimeStamp); | 27 void computeIntersectionObservations(DOMHighResTimeStamp); |
30 void disconnect(); | 28 void disconnect(); |
31 void clearRootAndRemoveFromTarget(); | 29 void clearRootAndRemoveFromTarget(); |
32 | 30 |
33 DECLARE_TRACE(); | 31 DECLARE_TRACE(); |
34 | 32 |
35 private: | 33 private: |
36 Member<IntersectionObserver> m_observer; | 34 Member<IntersectionObserver> m_observer; |
37 WeakMember<Element> m_target; | 35 WeakMember<Element> m_target; |
38 | 36 |
39 const unsigned m_shouldReportRootBounds : 1; | 37 const unsigned m_shouldReportRootBounds : 1; |
40 unsigned m_lastThresholdIndex : 30; | 38 unsigned m_lastThresholdIndex : 30; |
41 }; | 39 }; |
42 | 40 |
43 } // namespace blink | 41 } // namespace blink |
44 | 42 |
45 #endif // IntersectionObservation_h | 43 #endif // IntersectionObservation_h |
OLD | NEW |