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

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

Issue 2553103004: Refactor IntersectionGeometry class and move it to core/layout. (Closed)
Patch Set: Simplify isContainingBlockChainDescendant 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 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 enum ReportRootBounds {
23 kShouldReportRootBounds,
24 kShouldNotReportRootBounds,
25 };
26
27 IntersectionGeometry(Node* root,
28 Element* target,
29 const Vector<Length>& rootMargin,
30 ReportRootBounds shouldReportRootBounds);
31 ~IntersectionGeometry();
32
33 void computeGeometry();
34 LayoutRect targetRect() const { return m_targetRect; }
35 LayoutRect intersectionRect() const { return m_intersectionRect; }
36 LayoutRect rootRect() const { return m_rootRect; }
37 bool doesIntersect() const { return m_doesIntersect; }
38
39 IntRect intersectionIntRect() const {
40 return pixelSnappedIntRect(m_intersectionRect);
41 }
42
43 IntRect targetIntRect() const { return pixelSnappedIntRect(m_targetRect); }
44
45 IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); }
46
47 DECLARE_TRACE();
48
49 private:
50 void initializeGeometry();
51 void initializeTargetRect();
52 void initializeRootRect();
53 void clipToRoot();
54 void mapTargetRectToTargetFrameCoordinates();
55 void mapRootRectToRootFrameCoordinates();
56 void mapRootRectToTargetFrameCoordinates();
57 Element* root() const;
58 LayoutObject* getRootLayoutObject() const;
59 void applyRootMargin();
60
61 Member<Node> m_root;
62 Member<Element> m_target;
63 const Vector<Length> m_rootMargin;
64 const ReportRootBounds m_shouldReportRootBounds;
65 LayoutRect m_targetRect;
66 LayoutRect m_intersectionRect;
67 LayoutRect m_rootRect;
68 bool m_doesIntersect = false;
69 };
70
71 } // namespace blink
72
73 #endif // IntersectionGeometry_h
OLDNEW
« 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