| 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 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 targetIntRect() const { return pixelSnappedIntRect(m_targetRect); } |
| 39 |
| 40 IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); } |
| 41 |
| 42 DECLARE_TRACE(); |
| 43 |
| 44 private: |
| 45 void initializeGeometry(); |
| 46 void initializeTargetRect(); |
| 47 void initializeRootRect(); |
| 48 void clipToRoot(); |
| 49 void mapTargetRectToTargetFrameCoordinates(); |
| 50 void mapRootRectToRootFrameCoordinates(); |
| 51 void mapRootRectToTargetFrameCoordinates(); |
| 52 Element* root() const; |
| 53 LayoutObject* getRootLayoutObject() const; |
| 54 void applyRootMargin(); |
| 55 |
| 56 Member<Node> m_root; |
| 57 Member<Element> m_target; |
| 58 const Vector<Length> m_rootMargin; |
| 59 bool m_shouldReportRootBounds; |
| 60 LayoutRect m_targetRect; |
| 61 LayoutRect m_intersectionRect; |
| 62 LayoutRect m_rootRect; |
| 63 bool m_doesIntersect = false; |
| 64 }; |
| 65 |
| 66 } // namespace blink |
| 67 |
| 68 #endif // IntersectionGeometry_h |
| OLD | NEW |