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 "platform/geometry/LayoutRect.h" | 8 #include "platform/geometry/LayoutRect.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 LayoutRect rootRect; | 25 LayoutRect rootRect; |
26 }; | 26 }; |
27 | 27 |
28 IntersectionObserver& observer() const { return *m_observer; } | 28 IntersectionObserver& observer() const { return *m_observer; } |
29 Element* target() const; | 29 Element* target() const; |
30 bool isActive() const { return m_active; } | 30 bool isActive() const { return m_active; } |
31 void setActive(bool active) { m_active = active; } | 31 void setActive(bool active) { m_active = active; } |
32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } | 32 unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } | 33 void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } | 34 bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
35 | |
36 void computeIntersectionObservations(double timestamp); | 35 void computeIntersectionObservations(double timestamp); |
37 void disconnect(); | 36 void disconnect(); |
| 37 void clearRootAndRemoveFromTarget(); |
38 | 38 |
39 DECLARE_TRACE(); | 39 DECLARE_TRACE(); |
40 | 40 |
41 private: | 41 private: |
42 void initializeGeometry(IntersectionGeometry&); | 42 void initializeGeometry(IntersectionGeometry&); |
43 void clipToRoot(LayoutRect&); | 43 void clipToRoot(LayoutRect&); |
44 void clipToFrameView(IntersectionGeometry&); | 44 void clipToFrameView(IntersectionGeometry&); |
45 bool computeGeometry(IntersectionGeometry&); | 45 bool computeGeometry(IntersectionGeometry&); |
46 | 46 |
47 Member<IntersectionObserver> m_observer; | 47 Member<IntersectionObserver> m_observer; |
48 | 48 |
49 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser
verData::createWeakPtr() | 49 // TODO(szager): Why Node instead of Element? Because NodeIntersectionObser
verData::createWeakPtr() |
50 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>.
When oilpan rolls out, | 50 // returns a WeakPtr<Node>, which cannot be coerced into a WeakPtr<Element>.
When oilpan rolls out, |
51 // this can be changed to WeakMember<Element>. | 51 // this can be changed to WeakMember<Element>. |
52 WeakPtrWillBeWeakMember<Node> m_target; | 52 WeakPtrWillBeWeakMember<Node> m_target; |
53 | 53 |
54 unsigned m_active : 1; | 54 unsigned m_active : 1; |
55 unsigned m_shouldReportRootBounds : 1; | 55 unsigned m_shouldReportRootBounds : 1; |
56 unsigned m_lastThresholdIndex : 30; | 56 unsigned m_lastThresholdIndex : 30; |
57 }; | 57 }; |
58 | 58 |
59 } // namespace blink | 59 } // namespace blink |
60 | 60 |
61 #endif // IntersectionObservation_h | 61 #endif // IntersectionObservation_h |
OLD | NEW |