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

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

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Moved the calculation of intersection ratio to RemotingController. 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/IntersectionObservation.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObservation.h b/third_party/WebKit/Source/core/dom/IntersectionObservation.h
index cd87187c0a122f10d54e3965ed67354daa40e01e..36177ba112c9a1161dffae01c5b53c065b530ae5 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.h
@@ -14,12 +14,15 @@ namespace blink {
class Element;
class IntersectionObserver;
-class IntersectionObservation final
- : public GarbageCollected<IntersectionObservation> {
+class IntersectionObservation
+ : public GarbageCollectedFinalized<IntersectionObservation> {
+ WTF_MAKE_NONCOPYABLE(IntersectionObservation);
+
public:
IntersectionObservation(IntersectionObserver&,
Element&,
bool shouldReportRootBounds);
+ virtual ~IntersectionObservation();
struct IntersectionGeometry {
LayoutRect targetRect;
@@ -35,12 +38,15 @@ class IntersectionObservation final
unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
- void computeIntersectionObservations(DOMHighResTimeStamp);
+ virtual void computeIntersectionObservations(DOMHighResTimeStamp);
void disconnect();
void clearRootAndRemoveFromTarget();
DECLARE_TRACE();
+ protected:
+ bool computeGeometry(IntersectionGeometry&) const;
+
private:
void applyRootMargin(LayoutRect&) const;
void initializeGeometry(IntersectionGeometry&) const;
@@ -50,7 +56,6 @@ class IntersectionObservation final
void mapTargetRectToTargetFrameCoordinates(LayoutRect&) const;
void mapRootRectToRootFrameCoordinates(LayoutRect&) const;
void mapRootRectToTargetFrameCoordinates(LayoutRect&) const;
- bool computeGeometry(IntersectionGeometry&) const;
Member<IntersectionObserver> m_observer;
@@ -60,6 +65,19 @@ class IntersectionObservation final
unsigned m_lastThresholdIndex : 30;
};
+class ViewportIntersectionObservation final : public IntersectionObservation {
+ WTF_MAKE_NONCOPYABLE(ViewportIntersectionObservation);
+
+ public:
+ ViewportIntersectionObservation(IntersectionObserver&, Element&);
+ ~ViewportIntersectionObservation() final;
+
+ void computeIntersectionObservations(DOMHighResTimeStamp) final;
+
+ private:
+ LayoutRect m_lastIntersectRect;
+};
+
} // namespace blink
#endif // IntersectionObservation_h

Powered by Google App Engine
This is Rietveld 408576698