| 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/IntersectionObservation.h" | 9 #include "core/dom/IntersectionObservation.h" |
| 10 #include "core/dom/IntersectionObserverEntry.h" | 10 #include "core/dom/IntersectionObserverEntry.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); | 49 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); |
| 50 void applyRootMargin(LayoutRect&) const; | 50 void applyRootMargin(LayoutRect&) const; |
| 51 unsigned firstThresholdGreaterThan(float ratio) const; | 51 unsigned firstThresholdGreaterThan(float ratio) const; |
| 52 void deliver(); | 52 void deliver(); |
| 53 void removeObservation(IntersectionObservation&); | 53 void removeObservation(IntersectionObservation&); |
| 54 bool hasEntries() const { return m_entries.size(); } | 54 bool hasEntries() const { return m_entries.size(); } |
| 55 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations()
const { return m_observations; } | 55 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations()
const { return m_observations; } |
| 56 | 56 |
| 57 DECLARE_TRACE(); | 57 DECLARE_TRACE(); |
| 58 | 58 |
| 59 private: | 59 // private: |
| 60 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); | 60 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); |
| 61 void clearWeakMembers(Visitor*); | 61 void observe(Element*); |
| 62 void unobserve(Element*); |
| 63 private: |
| 64 void clearWeakMembers(Visitor*); |
| 62 | 65 |
| 63 Member<IntersectionObserverCallback> m_callback; | 66 Member<IntersectionObserverCallback> m_callback; |
| 64 WeakMember<Node> m_root; | 67 WeakMember<Node> m_root; |
| 65 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; | 68 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; |
| 66 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 69 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
| 67 Vector<float> m_thresholds; | 70 Vector<float> m_thresholds; |
| 68 Length m_topMargin; | 71 Length m_topMargin; |
| 69 Length m_rightMargin; | 72 Length m_rightMargin; |
| 70 Length m_bottomMargin; | 73 Length m_bottomMargin; |
| 71 Length m_leftMargin; | 74 Length m_leftMargin; |
| 72 }; | 75 }; |
| 73 | 76 |
| 74 } // namespace blink | 77 } // namespace blink |
| 75 | 78 |
| 76 #endif // IntersectionObserver_h | 79 #endif // IntersectionObserver_h |
| OLD | NEW |