| 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 27 matching lines...) Expand all Loading... |
| 38 // delivered. kAuto means the initial observation will always get sent. | 38 // delivered. kAuto means the initial observation will always get sent. |
| 39 enum class InitialState { | 39 enum class InitialState { |
| 40 // TODO(skyostil): Add support for kVisible. | 40 // TODO(skyostil): Add support for kVisible. |
| 41 kAuto, | 41 kAuto, |
| 42 kHidden, | 42 kHidden, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 static IntersectionObserver* create(const IntersectionObserverInit&, | 45 static IntersectionObserver* create(const IntersectionObserverInit&, |
| 46 IntersectionObserverCallback&, | 46 IntersectionObserverCallback&, |
| 47 ExceptionState&); | 47 ExceptionState&); |
| 48 // Observes any changes on intersection rect when |thresholds| is empty. |
| 48 static IntersectionObserver* create(const Vector<Length>& rootMargin, | 49 static IntersectionObserver* create(const Vector<Length>& rootMargin, |
| 49 const Vector<float>& thresholds, | 50 const Vector<float>& thresholds, |
| 50 Document*, | 51 Document*, |
| 51 std::unique_ptr<EventCallback>, | 52 std::unique_ptr<EventCallback>, |
| 52 ExceptionState& = ASSERT_NO_EXCEPTION); | 53 ExceptionState& = ASSERT_NO_EXCEPTION); |
| 53 static void resumeSuspendedObservers(); | 54 static void resumeSuspendedObservers(); |
| 54 | 55 |
| 55 // API methods. | 56 // API methods. |
| 56 void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); | 57 void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); |
| 57 void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); | 58 void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 Member<IntersectionObserverCallback> m_callback; | 100 Member<IntersectionObserverCallback> m_callback; |
| 100 WeakMember<Node> m_root; | 101 WeakMember<Node> m_root; |
| 101 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; | 102 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; |
| 102 HeapVector<Member<IntersectionObserverEntry>> m_entries; | 103 HeapVector<Member<IntersectionObserverEntry>> m_entries; |
| 103 Vector<float> m_thresholds; | 104 Vector<float> m_thresholds; |
| 104 Length m_topMargin; | 105 Length m_topMargin; |
| 105 Length m_rightMargin; | 106 Length m_rightMargin; |
| 106 Length m_bottomMargin; | 107 Length m_bottomMargin; |
| 107 Length m_leftMargin; | 108 Length m_leftMargin; |
| 108 InitialState m_initialState; | 109 InitialState m_initialState; |
| 110 bool m_observeViewportIntersection; |
| 109 }; | 111 }; |
| 110 | 112 |
| 111 } // namespace blink | 113 } // namespace blink |
| 112 | 114 |
| 113 #endif // IntersectionObserver_h | 115 #endif // IntersectionObserver_h |
| OLD | NEW |