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

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionGeometry.h

Issue 2511143006: Detect change on the intersection of video and viewport. (Closed)
Patch Set: Addressed miu'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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IntersectionGeometry_h
6 #define IntersectionGeometry_h
7
8 #include "platform/Length.h"
9 #include "platform/geometry/LayoutRect.h"
10 #include "platform/heap/Handle.h"
11 #include "wtf/Vector.h"
12
13 namespace blink {
14
15 class Node;
16 class Element;
17 class LayoutObject;
18
19 class IntersectionGeometry final
20 : public GarbageCollectedFinalized<IntersectionGeometry> {
21 public:
22 IntersectionGeometry(Node* root,
23 Element* target,
24 const Vector<Length>& rootMargin,
25 bool shouldReportRootBounds);
26 ~IntersectionGeometry();
27
28 void computeGeometry();
29 LayoutRect targetRect() const { return m_targetRect; }
30 LayoutRect intersectionRect() const { return m_intersectionRect; }
31 LayoutRect rootRect() const { return m_rootRect; }
32 bool doesIntersect() const { return m_doesIntersect; }
33
34 IntRect intersectionIntRect() const {
35 return pixelSnappedIntRect(m_intersectionRect);
36 }
37
38 IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); }
39
40 DECLARE_TRACE();
41
42 private:
43 void initializeGeometry();
44 void initializeTargetRect();
45 void initializeRootRect();
46 void clipToRoot();
47 void mapTargetRectToTargetFrameCoordinates();
48 void mapRootRectToRootFrameCoordinates();
49 void mapRootRectToTargetFrameCoordinates();
50 Element* root() const;
51 LayoutObject* getRootLayoutObject() const;
szager1 2016/11/23 17:44:58 If there are methods on IntersectionObserver that
xjz 2016/11/23 23:43:25 Done.
52 void applyRootMargin();
53
54 Member<Node> m_root;
55 Member<Element> m_target;
56 const Vector<Length> m_rootMargin;
57 bool m_shouldReportRootBounds;
58 LayoutRect m_targetRect;
59 LayoutRect m_intersectionRect;
60 LayoutRect m_rootRect;
61 bool m_doesIntersect = false;
62 };
63
64 } // namespace blink
65
66 #endif // IntersectionGeometry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698