Index: third_party/WebKit/Source/core/dom/IntersectionObservation.h |
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.h b/third_party/WebKit/Source/core/dom/IntersectionObservation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..149f95b347a8710881537b22b851c830ba864007 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.h |
@@ -0,0 +1,56 @@ |
+// 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. |
+ |
+#include "platform/geometry/LayoutRect.h" |
+#include "platform/heap/Handle.h" |
+ |
+#ifndef IntersectionObservation_h |
+#define IntersectionObservation_h |
+ |
+namespace blink { |
+ |
+class Element; |
+class IntersectionObserver; |
+ |
+class IntersectionObservation : public GarbageCollectedFinalized<IntersectionObservation> { |
+public: |
+ IntersectionObservation(IntersectionObserver&, Element&, bool shouldReportRootBounds); |
haraken
2015/12/22 01:13:30
Can we add a destructor and add ASSERT(!m_target)?
szager1
2015/12/22 07:53:41
It should be OK to destruct an IntersectionObserva
|
+ |
+ struct IntersectionGeometry { |
+ LayoutRect targetRect; |
+ LayoutRect intersectionRect; |
+ LayoutRect rootRect; |
+ }; |
+ |
+ const IntersectionObserver* observer() const { return m_observer; } |
+ IntersectionObserver* observer() { return m_observer; } |
esprehn
2015/12/22 07:50:32
can these ever be null?
szager1
2015/12/22 08:49:50
No, switched to reference.
|
+ const Element* target() const { return m_target.get(); } |
+ Element* target() { return m_target.get(); } |
+ bool isActive() const { return m_active; } |
+ void setActive(bool active) { m_active = active; } |
+ unsigned lastThresholdIndex() const { return m_lastThresholdIndex; } |
+ void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; } |
+ bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
+ |
+ void computeIntersectionObservations(double timestamp); |
+ void disconnect(); |
+ |
+ DECLARE_TRACE(); |
+ |
+private: |
+ void initializeGeometry(IntersectionGeometry&); |
+ void clipToRoot(LayoutRect&); |
+ void clipToFrameView(IntersectionGeometry&); |
+ bool computeGeometry(IntersectionGeometry&); |
+ |
+ Member<IntersectionObserver> m_observer; |
+ WeakPtrWillBeWeakMember<Element> m_target; |
haraken
2015/12/22 01:13:30
In oilpan, why does this need to be a WeakMember?
szager1
2015/12/22 07:53:41
The IntersectionObservation should not
|
+ unsigned m_active : 1; |
+ unsigned m_shouldReportRootBounds : 1; |
+ unsigned m_lastThresholdIndex : 30; |
+}; |
+ |
+} // namespace blink { |
+ |
+#endif // IntersectionObservation_h |