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

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

Issue 2511143006: Detect change on the intersection of video and viewport. (Closed)
Patch Set: Rebase again. Created 4 years 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/IntersectionGeometry.h
diff --git a/third_party/WebKit/Source/core/dom/IntersectionGeometry.h b/third_party/WebKit/Source/core/dom/IntersectionGeometry.h
new file mode 100644
index 0000000000000000000000000000000000000000..ba944567f2d01b48de94a0b0e07e48e10882ce95
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/IntersectionGeometry.h
@@ -0,0 +1,73 @@
+// Copyright 2016 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 IntersectionGeometry_h
+#define IntersectionGeometry_h
+
+#include "platform/Length.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/heap/Handle.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class Node;
+class Element;
+class LayoutObject;
+
+class IntersectionGeometry final
+ : public GarbageCollectedFinalized<IntersectionGeometry> {
+ public:
+ enum ReportRootBounds {
+ kShouldReportRootBounds,
+ kShouldNotReportRootBounds,
+ };
+
+ IntersectionGeometry(Node* root,
+ Element* target,
+ const Vector<Length>& rootMargin,
+ ReportRootBounds shouldReportRootBounds);
+ ~IntersectionGeometry();
+
+ void computeGeometry();
+ LayoutRect targetRect() const { return m_targetRect; }
+ LayoutRect intersectionRect() const { return m_intersectionRect; }
+ LayoutRect rootRect() const { return m_rootRect; }
+ bool doesIntersect() const { return m_doesIntersect; }
+
+ IntRect intersectionIntRect() const {
+ return pixelSnappedIntRect(m_intersectionRect);
+ }
+
+ IntRect targetIntRect() const { return pixelSnappedIntRect(m_targetRect); }
+
+ IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); }
+
+ DECLARE_TRACE();
+
+ private:
+ void initializeGeometry();
+ void initializeTargetRect();
+ void initializeRootRect();
+ void clipToRoot();
+ void mapTargetRectToTargetFrameCoordinates();
+ void mapRootRectToRootFrameCoordinates();
+ void mapRootRectToTargetFrameCoordinates();
+ Element* root() const;
+ LayoutObject* getRootLayoutObject() const;
+ void applyRootMargin();
+
+ Member<Node> m_root;
+ Member<Element> m_target;
+ const Vector<Length> m_rootMargin;
+ const ReportRootBounds m_shouldReportRootBounds;
+ LayoutRect m_targetRect;
+ LayoutRect m_intersectionRect;
+ LayoutRect m_rootRect;
+ bool m_doesIntersect = false;
+};
+
+} // namespace blink
+
+#endif // IntersectionGeometry_h
« no previous file with comments | « third_party/WebKit/Source/core/dom/BUILD.gn ('k') | third_party/WebKit/Source/core/dom/IntersectionGeometry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698