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 50% |
rename from third_party/WebKit/Source/core/dom/IntersectionGeometry.h |
rename to third_party/WebKit/Source/core/layout/IntersectionGeometry.h |
index ba944567f2d01b48de94a0b0e07e48e10882ce95..6bce2b381fb78e3c5904c7f66d279bcd13adc0b9 100644 |
--- a/third_party/WebKit/Source/core/dom/IntersectionGeometry.h |
+++ b/third_party/WebKit/Source/core/layout/IntersectionGeometry.h |
@@ -12,29 +12,45 @@ |
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 rootIsImplicit() const { return m_rootIsImplicit; } |
bool doesIntersect() const { return m_doesIntersect; } |
+ bool shouldReportRootBounds() const { return m_shouldReportRootBounds; } |
xjz
2016/12/07 01:01:14
This seems is not used anywhere in this CL. Maybe
szager1
2016/12/07 01:30:49
There is one direct usage of the member variable;
|
+ |
+ // Returns true iff it's possible to compute an intersection between root |
+ // and target. |
+ bool isValid() const { return m_isValid; } |
xjz
2016/12/07 01:01:14
All these added APIs seems are only used by Inters
szager1
2016/12/07 01:30:49
Done.
|
IntRect intersectionIntRect() const { |
return pixelSnappedIntRect(m_intersectionRect); |
@@ -44,28 +60,26 @@ class IntersectionGeometry final |
IntRect rootIntRect() const { return pixelSnappedIntRect(m_rootRect); } |
- DECLARE_TRACE(); |
- |
private: |
- void initializeGeometry(); |
+ bool initializeGeometry(Element* root, Element& target); |
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; |
+ 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_shouldReportRootBounds : 1; |
xjz
2016/12/07 01:01:14
const?
szager1
2016/12/07 01:30:49
Done.
|
+ unsigned m_rootIsImplicit : 1; |
xjz
2016/12/07 01:01:14
ditto: const
szager1
2016/12/07 01:30:49
Done.
|
+ unsigned m_doesIntersect : 1; |
+ unsigned m_isValid : 1; |
xjz
2016/12/07 01:01:14
ditto: const
szager1
2016/12/07 01:30:49
Done.
|
}; |
} // namespace blink |