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 IntersectionObserver_h | 5 #ifndef IntersectionObserver_h |
6 #define IntersectionObserver_h | 6 #define IntersectionObserver_h |
7 | 7 |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/dom/IntersectionObservation.h" | 10 #include "core/dom/IntersectionObservation.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); | 73 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); |
74 void applyRootMargin(LayoutRect&) const; | 74 void applyRootMargin(LayoutRect&) const; |
75 unsigned firstThresholdGreaterThan(float ratio) const; | 75 unsigned firstThresholdGreaterThan(float ratio) const; |
76 void deliver(); | 76 void deliver(); |
77 void removeObservation(IntersectionObservation&); | 77 void removeObservation(IntersectionObservation&); |
78 bool hasEntries() const { return m_entries.size(); } | 78 bool hasEntries() const { return m_entries.size(); } |
79 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations() | 79 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations() |
80 const { | 80 const { |
81 return m_observations; | 81 return m_observations; |
82 } | 82 } |
| 83 void intersectWithRemoteAncestorsIfNeeded(LayoutRect&); |
83 | 84 |
84 // Set the assumed initial state of the observed element. Note that this can | 85 // Set the assumed initial state of the observed element. Note that this can |
85 // only be set before calling observe(). | 86 // only be set before calling observe(). |
86 // TODO(skyostil): Move this setting to IntersectionObserverInit once the API | 87 // TODO(skyostil): Move this setting to IntersectionObserverInit once the API |
87 // is finalized. | 88 // is finalized. |
88 void setInitialState(InitialState); | 89 void setInitialState(InitialState); |
89 | 90 |
90 DECLARE_TRACE(); | 91 DECLARE_TRACE(); |
91 | 92 |
92 private: | 93 private: |
93 explicit IntersectionObserver(IntersectionObserverCallback&, | 94 explicit IntersectionObserver(IntersectionObserverCallback&, |
94 Node&, | 95 Node&, |
95 const Vector<Length>& rootMargin, | 96 const Vector<Length>& rootMargin, |
96 const Vector<float>& thresholds); | 97 const Vector<float>& thresholds, |
| 98 bool intersectWithRemoteAncestors); |
97 void clearWeakMembers(Visitor*); | 99 void clearWeakMembers(Visitor*); |
98 | 100 |
99 Member<IntersectionObserverCallback> m_callback; | 101 Member<IntersectionObserverCallback> m_callback; |
100 WeakMember<Node> m_root; | 102 WeakMember<Node> m_root; |
101 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; | 103 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; |
102 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 104 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
103 Vector<float> m_thresholds; | 105 Vector<float> m_thresholds; |
104 Length m_topMargin; | 106 Length m_topMargin; |
105 Length m_rightMargin; | 107 Length m_rightMargin; |
106 Length m_bottomMargin; | 108 Length m_bottomMargin; |
107 Length m_leftMargin; | 109 Length m_leftMargin; |
108 InitialState m_initialState; | 110 InitialState m_initialState; |
| 111 bool m_intersectWithRemoteAncestors; |
109 }; | 112 }; |
110 | 113 |
111 } // namespace blink | 114 } // namespace blink |
112 | 115 |
113 #endif // IntersectionObserver_h | 116 #endif // IntersectionObserver_h |
OLD | NEW |