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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.h

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Fix trybots failure. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/IntersectionObserver.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.h b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
index 3281fcea96352ef256fc00bd74383250e40b02ac..12c3104a091ee02eb8533279485fb10b5d87cb18 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
@@ -23,12 +23,14 @@ class LayoutObject;
class IntersectionObserverCallback;
class IntersectionObserverInit;
-class CORE_EXPORT IntersectionObserver final
+class CORE_EXPORT IntersectionObserver
: public GarbageCollectedFinalized<IntersectionObserver>,
public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
+ virtual ~IntersectionObserver();
+
using EventCallback =
Function<void(const HeapVector<Member<IntersectionObserverEntry>>&),
WTF::SameThreadAffinity>;
@@ -45,6 +47,7 @@ class CORE_EXPORT IntersectionObserver final
static IntersectionObserver* create(const IntersectionObserverInit&,
IntersectionObserverCallback&,
ExceptionState&);
+ // Observes any changes on intersection rect when |thresholds| is empty.
static IntersectionObserver* create(const Vector<Length>& rootMargin,
const Vector<float>& thresholds,
Document*,
@@ -89,11 +92,15 @@ class CORE_EXPORT IntersectionObserver final
DECLARE_TRACE();
+ protected:
+ virtual IntersectionObservation* createObservation(Element&, bool);
+
+ IntersectionObserver(IntersectionObserverCallback&,
+ Node&,
+ const Vector<Length>& rootMargin,
+ const Vector<float>& thresholds);
+
private:
- explicit IntersectionObserver(IntersectionObserverCallback&,
- Node&,
- const Vector<Length>& rootMargin,
- const Vector<float>& thresholds);
void clearWeakMembers(Visitor*);
Member<IntersectionObserverCallback> m_callback;
@@ -108,6 +115,19 @@ class CORE_EXPORT IntersectionObserver final
InitialState m_initialState;
};
+class ViewportIntersectionObserver final : public IntersectionObserver {
+ WTF_MAKE_NONCOPYABLE(ViewportIntersectionObserver);
+
+ public:
+ ViewportIntersectionObserver(IntersectionObserverCallback&,
+ Node&,
+ const Vector<Length>&);
+ ~ViewportIntersectionObserver() final;
+
+ protected:
+ IntersectionObservation* createObservation(Element&, bool) final;
+};
+
} // namespace blink
#endif // IntersectionObserver_h

Powered by Google App Engine
This is Rietveld 408576698