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 25 matching lines...) Expand all Loading... |
36 String rootMargin() const; | 36 String rootMargin() const; |
37 const Vector<float>& thresholds() const { return m_thresholds; } | 37 const Vector<float>& thresholds() const { return m_thresholds; } |
38 | 38 |
39 Node* rootNode() const { return m_root.get(); } | 39 Node* rootNode() const { return m_root.get(); } |
40 LayoutObject* rootLayoutObject() const; | 40 LayoutObject* rootLayoutObject() const; |
41 bool hasPercentMargin() const; | 41 bool hasPercentMargin() const; |
42 const Length& topMargin() const { return m_topMargin; } | 42 const Length& topMargin() const { return m_topMargin; } |
43 const Length& rightMargin() const { return m_rightMargin; } | 43 const Length& rightMargin() const { return m_rightMargin; } |
44 const Length& bottomMargin() const { return m_bottomMargin; } | 44 const Length& bottomMargin() const { return m_bottomMargin; } |
45 const Length& leftMargin() const { return m_leftMargin; } | 45 const Length& leftMargin() const { return m_leftMargin; } |
46 bool isDescendantOfRoot(const Element*) const; | |
47 void computeIntersectionObservations(); | 46 void computeIntersectionObservations(); |
48 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); | 47 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); |
49 void applyRootMargin(LayoutRect&) const; | 48 void applyRootMargin(LayoutRect&) const; |
50 unsigned firstThresholdGreaterThan(float ratio) const; | 49 unsigned firstThresholdGreaterThan(float ratio) const; |
51 void deliver(); | 50 void deliver(); |
52 void setActive(bool); | |
53 void disconnect(); | 51 void disconnect(); |
54 void removeObservation(IntersectionObservation&); | 52 void removeObservation(IntersectionObservation&); |
55 bool hasEntries() const { return m_entries.size(); } | 53 bool hasEntries() const { return m_entries.size(); } |
56 | 54 |
57 DECLARE_TRACE(); | 55 DECLARE_TRACE(); |
58 | 56 |
59 private: | 57 private: |
60 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); | 58 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); |
61 #if ENABLE(OILPAN) | 59 #if ENABLE(OILPAN) |
62 void clearWeakMembers(Visitor*); | 60 void clearWeakMembers(Visitor*); |
63 #endif | 61 #endif |
64 | 62 |
65 Member<IntersectionObserverCallback> m_callback; | 63 Member<IntersectionObserverCallback> m_callback; |
66 WeakPtrWillBeWeakMember<Node> m_root; | 64 WeakPtrWillBeWeakMember<Node> m_root; |
67 HeapHashSet<WeakMember<IntersectionObservation>> m_observations; | 65 HeapHashSet<WeakMember<IntersectionObservation>> m_observations; |
68 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 66 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
69 Vector<float> m_thresholds; | 67 Vector<float> m_thresholds; |
70 Length m_topMargin; | 68 Length m_topMargin; |
71 Length m_rightMargin; | 69 Length m_rightMargin; |
72 Length m_bottomMargin; | 70 Length m_bottomMargin; |
73 Length m_leftMargin; | 71 Length m_leftMargin; |
74 }; | 72 }; |
75 | 73 |
76 } // namespace blink | 74 } // namespace blink |
77 | 75 |
78 #endif // IntersectionObserver_h | 76 #endif // IntersectionObserver_h |
OLD | NEW |