| OLD | NEW |
| (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 | |
| OLD | NEW |