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

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

Issue 2511143006: Detect change on the intersection of video and viewport. (Closed)
Patch Set: Addressed ojan's comments. 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..80c6a80aa2f4b644213674d5d27cc9c607e897d9 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObservation.h
+++ b/third_party/WebKit/Source/core/dom/IntersectionObservation.h
@@ -6,7 +6,7 @@
#define IntersectionObservation_h
#include "core/dom/DOMHighResTimeStamp.h"
-#include "platform/geometry/LayoutRect.h"
+#include "core/dom/IntersectionGeometry.h"
#include "platform/heap/Handle.h"
namespace blink {
@@ -17,24 +17,15 @@ class IntersectionObserver;
class IntersectionObservation final
: public GarbageCollected<IntersectionObservation> {
public:
- IntersectionObservation(IntersectionObserver&,
- Element&,
- bool shouldReportRootBounds);
-
- struct IntersectionGeometry {
- LayoutRect targetRect;
- LayoutRect intersectionRect;
- LayoutRect rootRect;
- bool doesIntersect;
-
- IntersectionGeometry() : doesIntersect(false) {}
- };
+ IntersectionObservation(
+ IntersectionObserver&,
+ Element&,
+ IntersectionGeometry::ReportRootBounds shouldReportRootBounds);
IntersectionObserver& observer() const { return *m_observer; }
Element* target() const { return m_target; }
unsigned lastThresholdIndex() const { return m_lastThresholdIndex; }
void setLastThresholdIndex(unsigned index) { m_lastThresholdIndex = index; }
- bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
void computeIntersectionObservations(DOMHighResTimeStamp);
void disconnect();
void clearRootAndRemoveFromTarget();
@@ -42,22 +33,11 @@ class IntersectionObservation final
DECLARE_TRACE();
private:
- void applyRootMargin(LayoutRect&) const;
- void initializeGeometry(IntersectionGeometry&) const;
- void initializeTargetRect(LayoutRect&) const;
- void initializeRootRect(LayoutRect&) const;
- void clipToRoot(IntersectionGeometry&) const;
- void mapTargetRectToTargetFrameCoordinates(LayoutRect&) const;
- void mapRootRectToRootFrameCoordinates(LayoutRect&) const;
- void mapRootRectToTargetFrameCoordinates(LayoutRect&) const;
- bool computeGeometry(IntersectionGeometry&) const;
-
Member<IntersectionObserver> m_observer;
-
WeakMember<Element> m_target;
- unsigned m_shouldReportRootBounds : 1;
- unsigned m_lastThresholdIndex : 30;
+ IntersectionGeometry::ReportRootBounds m_shouldReportRootBounds;
+ unsigned m_lastThresholdIndex;
ojan 2016/11/24 03:06:06 Please keep the : 1 and the : 30. That should work
xjz 2016/11/30 01:58:44 Yes, it still only takes 1 bit. The only reason I
miu 2016/11/30 03:40:36 You can make it unsigned. Just initialize it in th
xjz 2016/11/30 07:05:54 Yes, that is what toShouldReportRootBounds() does.
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698