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/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class Element; | 14 class Element; |
15 class IntersectionObserver; | 15 class IntersectionObserver; |
16 | 16 |
17 class IntersectionObservation final : public GarbageCollected<IntersectionObserv
ation> { | 17 class IntersectionObservation final : public GarbageCollected<IntersectionObserv
ation> { |
18 public: | 18 public: |
19 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo
otBounds); | 19 IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRo
otBounds); |
20 | 20 |
21 struct IntersectionGeometry { | 21 struct IntersectionGeometry { |
22 LayoutRect targetRect; | 22 LayoutRect targetRect; |
23 LayoutRect intersectionRect; | 23 LayoutRect intersectionRect; |
24 LayoutRect rootRect; | 24 LayoutRect rootRect; |
25 bool doesIntersect; | 25 bool doesIntersect; |
| 26 |
| 27 IntersectionGeometry() : doesIntersect(false) {} |
26 }; | 28 }; |
27 | 29 |
28 IntersectionObserver& observer() const { return *m_observer; } | 30 IntersectionObserver& observer() const { return *m_observer; } |
29 Element* target() const { return m_target; } | 31 Element* target() const { return m_target; } |
30 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | 32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
31 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | 33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
32 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } | 34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
33 void computeIntersectionObservations(DOMHighResTimeStamp); | 35 void computeIntersectionObservations(DOMHighResTimeStamp); |
34 void disconnect(); | 36 void disconnect(); |
35 void clearRootAndRemoveFromTarget(); | 37 void clearRootAndRemoveFromTarget(); |
(...skipping 15 matching lines...) Expand all Loading... |
51 | 53 |
52 WeakMember<Element> m_target; | 54 WeakMember<Element> m_target; |
53 | 55 |
54 unsigned m_shouldReportRootBounds : 1; | 56 unsigned m_shouldReportRootBounds : 1; |
55 unsigned m_lastThresholdIndex : 30; | 57 unsigned m_lastThresholdIndex : 30; |
56 }; | 58 }; |
57 | 59 |
58 } // namespace blink | 60 } // namespace blink |
59 | 61 |
60 #endif // IntersectionObservation_h | 62 #endif // IntersectionObservation_h |
OLD | NEW |