Index: third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.h |
diff --git a/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.h b/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..709394d6f0f273f6b813514e7d90d142b979fa11 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ElementIntersectionObserverData_h |
+#define ElementIntersectionObserverData_h |
+ |
+#include "platform/heap/Handle.h" |
+ |
+namespace blink { |
+ |
+class Element; |
+class IntersectionObservation; |
+class IntersectionObserver; |
+ |
+class ElementIntersectionObserverData : public GarbageCollectedFinalized<ElementIntersectionObserverData> { |
+public: |
+ DECLARE_TRACE(); |
+ ElementIntersectionObserverData(); |
+ ~ElementIntersectionObserverData(); |
+ |
+ bool hasIntersectionObserver() const; |
+ bool hasIntersectionObservation() const; |
+ bool hasObservationFor(IntersectionObserver&) const; |
+ void addObservation(IntersectionObservation&); |
+ void removeObservation(IntersectionObserver&); |
+ void activateValidIntersectionObservers(Element&); |
+ void deactivateAllIntersectionObservers(Element&); |
+ |
+#if !ENABLE(OILPAN) |
+ void dispose(); |
+#endif |
+ |
+ WeakPtr<Element> createWeakPtr(Element*); |
+ |
+private: |
+ // IntersectionObservers for which the Element owning this data is root. |
haraken
2015/12/22 01:13:29
Help me understand: Is it possible that a non-Docu
esprehn
2015/12/22 07:50:32
root can be any element that's an ancestor.
szager1
2015/12/22 07:53:41
The root can be any container element; see the spe
|
+ HeapHashSet<WeakMember<IntersectionObserver>> m_intersectionObservers; |
+ // IntersectionObservations for which the Element owning this data is target. |
+ HeapHashMap<Member<IntersectionObserver>, Member<IntersectionObservation>> m_intersectionObservations; |
haraken
2015/12/22 01:13:29
I don't fully understand why we need this mapping.
szager1
2015/12/22 07:53:41
Please take a look at the design doc linked in CL
|
+ |
+#if !ENABLE(OILPAN) |
+ OwnPtrWillBeMember<WeakPtrFactory<Element>> m_weakPointerFactory; |
haraken
2015/12/22 01:13:30
This can simply be:
WeakPtrFactory<Element>
Ow
szager1
2015/12/22 07:53:41
WeakPtrFactory must be constructed with a pointer
|
+#endif |
+}; |
+ |
+} // namespace blink { |
+ |
+#endif // ElementIntersectionObserverData_h |