| 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; } | 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; } | 26 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
| 27 void computeIntersectionObservations(DOMHighResTimeStamp); | 27 void computeIntersectionObservations(DOMHighResTimeStamp); |
| 28 void disconnect(); | 28 void disconnect(); |
| 29 void clearRootAndRemoveFromTarget(); | |
| 30 | 29 |
| 31 DECLARE_TRACE(); | 30 DECLARE_TRACE(); |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 Member<IntersectionObserver> m_observer; | 33 Member<IntersectionObserver> m_observer; |
| 35 WeakMember<Element> m_target; | 34 WeakMember<Element> m_target; |
| 36 | 35 |
| 37 const unsigned m_shouldReportRootBounds : 1; | 36 const unsigned m_shouldReportRootBounds : 1; |
| 38 unsigned m_lastThresholdIndex : 30; | 37 unsigned m_lastThresholdIndex : 30; |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 } // namespace blink | 40 } // namespace blink |
| 42 | 41 |
| 43 #endif // IntersectionObservation_h | 42 #endif // IntersectionObservation_h |
| OLD | NEW |