Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.h

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Addressed comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 static IntersectionObserver* create(const Vector<Length>& rootMargin, 48 static IntersectionObserver* create(const Vector<Length>& rootMargin,
49 const Vector<float>& thresholds, 49 const Vector<float>& thresholds,
50 Document*, 50 Document*,
51 std::unique_ptr<EventCallback>, 51 std::unique_ptr<EventCallback>,
52 ExceptionState& = ASSERT_NO_EXCEPTION); 52 ExceptionState& = ASSERT_NO_EXCEPTION);
53 // Observes any element/viewport ratio changes.
54 static IntersectionObserver* create(const Vector<Length>& rootMargin,
szager1 2016/11/16 17:53:54 This constructor is unnecessary. Just pass an emp
xjz 2016/11/16 20:38:59 Done.
55 Document*,
56 std::unique_ptr<EventCallback>,
57 ExceptionState& = ASSERT_NO_EXCEPTION);
53 static void resumeSuspendedObservers(); 58 static void resumeSuspendedObservers();
54 59
55 // API methods. 60 // API methods.
56 void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); 61 void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION);
57 void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); 62 void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION);
58 void disconnect(ExceptionState& = ASSERT_NO_EXCEPTION); 63 void disconnect(ExceptionState& = ASSERT_NO_EXCEPTION);
59 HeapVector<Member<IntersectionObserverEntry>> takeRecords(ExceptionState&); 64 HeapVector<Member<IntersectionObserverEntry>> takeRecords(ExceptionState&);
60 65
61 // API attributes. 66 // API attributes.
62 Element* root() const; 67 Element* root() const;
(...skipping 23 matching lines...) Expand all
86 // TODO(skyostil): Move this setting to IntersectionObserverInit once the API 91 // TODO(skyostil): Move this setting to IntersectionObserverInit once the API
87 // is finalized. 92 // is finalized.
88 void setInitialState(InitialState); 93 void setInitialState(InitialState);
89 94
90 DECLARE_TRACE(); 95 DECLARE_TRACE();
91 96
92 private: 97 private:
93 explicit IntersectionObserver(IntersectionObserverCallback&, 98 explicit IntersectionObserver(IntersectionObserverCallback&,
94 Node&, 99 Node&,
95 const Vector<Length>& rootMargin, 100 const Vector<Length>& rootMargin,
96 const Vector<float>& thresholds); 101 const Vector<float>& thresholds,
102 bool observeViewportIntersection);
97 void clearWeakMembers(Visitor*); 103 void clearWeakMembers(Visitor*);
98 104
99 Member<IntersectionObserverCallback> m_callback; 105 Member<IntersectionObserverCallback> m_callback;
100 WeakMember<Node> m_root; 106 WeakMember<Node> m_root;
101 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations; 107 HeapLinkedHashSet<WeakMember<IntersectionObservation>> m_observations;
102 HeapVector<Member<IntersectionObserverEntry>> m_entries; 108 HeapVector<Member<IntersectionObserverEntry>> m_entries;
103 Vector<float> m_thresholds; 109 Vector<float> m_thresholds;
104 Length m_topMargin; 110 Length m_topMargin;
105 Length m_rightMargin; 111 Length m_rightMargin;
106 Length m_bottomMargin; 112 Length m_bottomMargin;
107 Length m_leftMargin; 113 Length m_leftMargin;
108 InitialState m_initialState; 114 InitialState m_initialState;
115 bool m_observeViewportIntersection;
109 }; 116 };
110 117
111 } // namespace blink 118 } // namespace blink
112 119
113 #endif // IntersectionObserver_h 120 #endif // IntersectionObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698