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/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/IntersectionObservation.h" | 10 #include "core/dom/IntersectionObservation.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 Element* root() { return m_root.get(); } | 35 Element* root() { return m_root.get(); } |
36 LayoutObject* rootLayoutObject(); | 36 LayoutObject* rootLayoutObject(); |
37 bool isDescendantOfRoot(const Element*) const; | 37 bool isDescendantOfRoot(const Element*) const; |
38 void computeIntersectionObservations(double timestamp); | 38 void computeIntersectionObservations(double timestamp); |
39 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); | 39 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); |
40 unsigned firstThresholdGreaterThan(float ratio) const; | 40 unsigned firstThresholdGreaterThan(float ratio) const; |
41 void deliver(); | 41 void deliver(); |
42 void setActive(bool); | 42 void setActive(bool); |
43 void disconnect(); | 43 void disconnect(); |
44 void removeObservation(IntersectionObservation&); | 44 void removeObservation(IntersectionObservation&); |
| 45 bool hasEntries() const { return m_entries.size(); } |
45 | 46 |
46 DECLARE_TRACE(); | 47 DECLARE_TRACE(); |
47 | 48 |
48 private: | 49 private: |
49 explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const
Vector<float>& thresholds); | 50 explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const
Vector<float>& thresholds); |
50 | 51 |
51 void checkRootAndDetachIfNeeded(); | 52 void checkRootAndDetachIfNeeded(); |
52 | 53 |
53 Member<IntersectionObserverCallback> m_callback; | 54 Member<IntersectionObserverCallback> m_callback; |
54 WeakPtrWillBeWeakMember<Element> m_root; | 55 WeakPtrWillBeWeakMember<Element> m_root; |
55 HeapHashSet<WeakMember<IntersectionObservation>> m_observations; | 56 HeapHashSet<WeakMember<IntersectionObservation>> m_observations; |
56 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 57 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
57 Vector<float> m_thresholds; | 58 Vector<float> m_thresholds; |
58 }; | 59 }; |
59 | 60 |
60 } // namespace blink | 61 } // namespace blink |
61 | 62 |
62 #endif // IntersectionObserver_h | 63 #endif // IntersectionObserver_h |
OLD | NEW |