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

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

Issue 1552213002: Implement suspend/resume for IntersectionObserver notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer
Patch Set: Create IntersectionObserverController on demand Created 4 years, 11 months 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/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 24 matching lines...) Expand all
35 Element* root() { return m_root.get(); } 35 Element* root() { return m_root.get(); }
36 LayoutObject* rootLayoutObject(); 36 LayoutObject* rootLayoutObject();
37 bool isDescendantOfRoot(const Element*) const; 37 bool isDescendantOfRoot(const Element*) const;
38 void computeIntersectionObservations(double timestamp); 38 void computeIntersectionObservations(double timestamp);
39 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&); 39 void enqueueIntersectionObserverEntry(IntersectionObserverEntry&);
40 unsigned firstThresholdGreaterThan(float ratio) const; 40 unsigned firstThresholdGreaterThan(float ratio) const;
41 void deliver(); 41 void deliver();
42 void setActive(bool); 42 void setActive(bool);
43 void disconnect(); 43 void disconnect();
44 void removeObservation(IntersectionObservation&); 44 void removeObservation(IntersectionObservation&);
45 bool hasEntries() const { return m_entries.size(); }
45 46
46 DECLARE_TRACE(); 47 DECLARE_TRACE();
47 48
48 private: 49 private:
49 explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const Vector<float>& thresholds); 50 explicit IntersectionObserver(IntersectionObserverCallback&, Element&, const Vector<float>& thresholds);
50 51
51 void checkRootAndDetachIfNeeded(); 52 void checkRootAndDetachIfNeeded();
52 53
53 Member<IntersectionObserverCallback> m_callback; 54 Member<IntersectionObserverCallback> m_callback;
54 WeakPtrWillBeWeakMember<Element> m_root; 55 WeakPtrWillBeWeakMember<Element> m_root;
55 HeapHashSet<WeakMember<IntersectionObservation>> m_observations; 56 HeapHashSet<WeakMember<IntersectionObservation>> m_observations;
56 HeapVector<Member<IntersectionObserverEntry>> m_entries; 57 HeapVector<Member<IntersectionObserverEntry>> m_entries;
57 Vector<float> m_thresholds; 58 Vector<float> m_thresholds;
58 }; 59 };
59 60
60 } // namespace blink 61 } // namespace blink
61 62
62 #endif // IntersectionObserver_h 63 #endif // IntersectionObserver_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/IntersectionObserverController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698