| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 const Length& leftMargin() const { return m_leftMargin; } | 52 const Length& leftMargin() const { return m_leftMargin; } |
| 53 void computeIntersectionObservations(); | 53 void computeIntersectionObservations(); |
| 54 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); | 54 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); |
| 55 void applyRootMargin(LayoutRect&) const; | 55 void applyRootMargin(LayoutRect&) const; |
| 56 unsigned firstThresholdGreaterThan(float ratio) const; | 56 unsigned firstThresholdGreaterThan(float ratio) const; |
| 57 void deliver(); | 57 void deliver(); |
| 58 void removeObservation(IntersectionObservation&); | 58 void removeObservation(IntersectionObservation&); |
| 59 bool hasEntries() const { return m_entries.size(); } | 59 bool hasEntries() const { return m_entries.size(); } |
| 60 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations()
const { return m_observations; } | 60 const HeapLinkedHashSet<WeakMember<IntersectionObservation>>& observations()
const { return m_observations; } |
| 61 | 61 |
| 62 // A low latency intersection observer delivers events with an immediately |
| 63 // posted task instead of waiting for an idle period (or up to 100ms). |
| 64 void setLowLatency(bool lowLatency) { m_lowLatency = lowLatency; } |
| 65 bool lowLatency() const { return m_lowLatency; } |
| 66 |
| 62 DECLARE_TRACE(); | 67 DECLARE_TRACE(); |
| 63 | 68 |
| 64 private: | 69 private: |
| 65 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); | 70 explicit IntersectionObserver(IntersectionObserverCallback&, Node&, const Ve
ctor<Length>& rootMargin, const Vector<float>& thresholds); |
| 66 void clearWeakMembers(Visitor*); | 71 void clearWeakMembers(Visitor*); |
| 67 | 72 |
| 68 Member<IntersectionObserverCallback> m_callback; | 73 Member<IntersectionObserverCallback> m_callback; |
| 69 WeakMember<Node> m_root; | 74 WeakMember<Node> m_root; |
| 70 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; | 75 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; |
| 71 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 76 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
| 72 Vector<float> m_thresholds; | 77 Vector<float> m_thresholds; |
| 73 Length m_topMargin; | 78 Length m_topMargin; |
| 74 Length m_rightMargin; | 79 Length m_rightMargin; |
| 75 Length m_bottomMargin; | 80 Length m_bottomMargin; |
| 76 Length m_leftMargin; | 81 Length m_leftMargin; |
| 82 bool m_lowLatency; |
| 77 }; | 83 }; |
| 78 | 84 |
| 79 } // namespace blink | 85 } // namespace blink |
| 80 | 86 |
| 81 #endif // IntersectionObserver_h | 87 #endif // IntersectionObserver_h |
| OLD | NEW |