| Index: third_party/WebKit/Source/core/layout/IntersectionGeometry.h
|
| diff --git a/third_party/WebKit/Source/core/dom/IntersectionGeometry.h b/third_party/WebKit/Source/core/layout/IntersectionGeometry.h
|
| similarity index 49%
|
| rename from third_party/WebKit/Source/core/dom/IntersectionGeometry.h
|
| rename to third_party/WebKit/Source/core/layout/IntersectionGeometry.h
|
| index ba944567f2d01b48de94a0b0e07e48e10882ce95..6244ddd8c08bc2271834789086384e98a51f685e 100644
|
| --- a/third_party/WebKit/Source/core/dom/IntersectionGeometry.h
|
| +++ b/third_party/WebKit/Source/core/layout/IntersectionGeometry.h
|
| @@ -12,28 +12,38 @@
|
|
|
| namespace blink {
|
|
|
| -class Node;
|
| class Element;
|
| class LayoutObject;
|
|
|
| -class IntersectionGeometry final
|
| - : public GarbageCollectedFinalized<IntersectionGeometry> {
|
| +// Computes the intersection between an ancestor (root) element and a
|
| +// descendant (target) element, with overflow and CSS clipping applied, but not
|
| +// paint occlusion.
|
| +//
|
| +// If the root argument to the constructor is null, computes the intersection
|
| +// of the target with the top-level frame viewport (AKA the "implicit root").
|
| +class IntersectionGeometry {
|
| + STACK_ALLOCATED()
|
| public:
|
| - enum ReportRootBounds {
|
| - kShouldReportRootBounds,
|
| - kShouldNotReportRootBounds,
|
| - };
|
| -
|
| - IntersectionGeometry(Node* root,
|
| - Element* target,
|
| + IntersectionGeometry(Element* root,
|
| + Element& target,
|
| const Vector<Length>& rootMargin,
|
| - ReportRootBounds shouldReportRootBounds);
|
| + bool shouldReportRootBounds);
|
| ~IntersectionGeometry();
|
|
|
| void computeGeometry();
|
| +
|
| + LayoutObject* root() const { return m_root; }
|
| + LayoutObject* target() const { return m_target; }
|
| +
|
| + // Client rect in the coordinate system of the frame containing target.
|
| LayoutRect targetRect() const { return m_targetRect; }
|
| +
|
| + // Client rect in the coordinate system of the frame containing target.
|
| LayoutRect intersectionRect() const { return m_intersectionRect; }
|
| +
|
| + // Client rect in the coordinate system of the frame containing root.
|
| LayoutRect rootRect() const { return m_rootRect; }
|
| +
|
| bool doesIntersect() const { return m_doesIntersect; }
|
|
|
| IntRect intersectionIntRect() const {
|
| @@ -44,28 +54,33 @@ class IntersectionGeometry final
|
|
|
| IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); }
|
|
|
| - DECLARE_TRACE();
|
| -
|
| private:
|
| + bool initializeCanComputeGeometry(Element* root, Element& target) const;
|
| void initializeGeometry();
|
| void initializeTargetRect();
|
| void initializeRootRect();
|
| void clipToRoot();
|
| void mapTargetRectToTargetFrameCoordinates();
|
| void mapRootRectToRootFrameCoordinates();
|
| - void mapRootRectToTargetFrameCoordinates();
|
| - Element* root() const;
|
| - LayoutObject* getRootLayoutObject() const;
|
| + void mapIntersectionRectToTargetFrameCoordinates();
|
| void applyRootMargin();
|
|
|
| - Member<Node> m_root;
|
| - Member<Element> m_target;
|
| + // Returns true iff it's possible to compute an intersection between root
|
| + // and target.
|
| + bool canComputeGeometry() const { return m_canComputeGeometry; }
|
| + bool rootIsImplicit() const { return m_rootIsImplicit; }
|
| + bool shouldReportRootBounds() const { return m_shouldReportRootBounds; }
|
| +
|
| + LayoutObject* m_root;
|
| + LayoutObject* m_target;
|
| const Vector<Length> m_rootMargin;
|
| - const ReportRootBounds m_shouldReportRootBounds;
|
| LayoutRect m_targetRect;
|
| LayoutRect m_intersectionRect;
|
| LayoutRect m_rootRect;
|
| - bool m_doesIntersect = false;
|
| + unsigned m_doesIntersect : 1;
|
| + const unsigned m_shouldReportRootBounds : 1;
|
| + const unsigned m_rootIsImplicit : 1;
|
| + const unsigned m_canComputeGeometry : 1;
|
| };
|
|
|
| } // namespace blink
|
|
|