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