summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/HitTestResult.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/HitTestResult.h')
-rw-r--r--Source/WebCore/rendering/HitTestResult.h64
1 files changed, 43 insertions, 21 deletions
diff --git a/Source/WebCore/rendering/HitTestResult.h b/Source/WebCore/rendering/HitTestResult.h
index e919472b2..a18fdb5a2 100644
--- a/Source/WebCore/rendering/HitTestResult.h
+++ b/Source/WebCore/rendering/HitTestResult.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,6 +23,7 @@
#define HitTestResult_h
#include "FloatRect.h"
+#include "HitTestRequest.h"
#include "LayoutTypes.h"
#include "TextDirection.h"
#include <wtf/Forward.h>
@@ -44,7 +46,42 @@ class Scrollbar;
enum ShadowContentFilterPolicy { DoNotAllowShadowContent, AllowShadowContent };
-class HitTestResult {
+class HitTestPoint {
+public:
+
+ HitTestPoint();
+ HitTestPoint(const LayoutPoint&);
+ // Pass non-negative padding values to perform a rect-based hit test.
+ HitTestPoint(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+ HitTestPoint(const HitTestPoint&);
+ ~HitTestPoint();
+ HitTestPoint& operator=(const HitTestPoint&);
+
+ LayoutPoint point() const { return m_point; }
+ IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
+
+ void setPoint(const LayoutPoint& p) { m_point = p; }
+
+ // Rect-based hit test related methods.
+ bool isRectBasedTest() const { return m_isRectBased; }
+ IntRect rectForPoint(const LayoutPoint&) const;
+ static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
+ int topPadding() const { return m_topPadding; }
+ int rightPadding() const { return m_rightPadding; }
+ int bottomPadding() const { return m_bottomPadding; }
+ int leftPadding() const { return m_leftPadding; }
+
+private:
+ LayoutPoint m_point;
+
+ int m_topPadding;
+ int m_rightPadding;
+ int m_bottomPadding;
+ int m_leftPadding;
+ bool m_isRectBased;
+};
+
+class HitTestResult : public HitTestPoint {
public:
typedef ListHashSet<RefPtr<Node> > NodeSet;
@@ -52,14 +89,13 @@ public:
HitTestResult(const LayoutPoint&);
// Pass non-negative padding values to perform a rect-based hit test.
HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, ShadowContentFilterPolicy);
+ HitTestResult(const HitTestPoint&, ShadowContentFilterPolicy);
HitTestResult(const HitTestResult&);
~HitTestResult();
HitTestResult& operator=(const HitTestResult&);
Node* innerNode() const { return m_innerNode.get(); }
Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
- LayoutPoint point() const { return m_point; }
- IntPoint roundedPoint() const { return roundedIntPoint(m_point); }
LayoutPoint localPoint() const { return m_localPoint; }
Element* URLElement() const { return m_innerURLElement.get(); }
Scrollbar* scrollbar() const { return m_scrollbar.get(); }
@@ -70,11 +106,11 @@ public:
void setToNonShadowAncestor();
+ const HitTestPoint& hitTestPoint() const { return *this; }
ShadowContentFilterPolicy shadowContentFilterPolicy() const { return m_shadowContentFilterPolicy; }
void setInnerNode(Node*);
void setInnerNonSharedNode(Node*);
- void setPoint(const LayoutPoint& p) { m_point = p; }
void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
void setURLElement(Element*);
void setScrollbar(Scrollbar*);
@@ -110,15 +146,6 @@ public:
bool mediaMuted() const;
void toggleMediaMuteState() const;
- // Rect-based hit test related methods.
- bool isRectBasedTest() const { return m_isRectBased; }
- IntRect rectForPoint(const LayoutPoint&) const;
- static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
- int topPadding() const { return m_topPadding; }
- int rightPadding() const { return m_rightPadding; }
- int bottomPadding() const { return m_bottomPadding; }
- int leftPadding() const { return m_leftPadding; }
-
// Returns true if it is rect-based hit test and needs to continue until the rect is fully
// enclosed by the boundaries of a node.
bool addNodeToRectBasedTestResult(Node*, const LayoutPoint& pointInContainer, const IntRect& = IntRect());
@@ -139,19 +166,14 @@ private:
RefPtr<Node> m_innerNode;
RefPtr<Node> m_innerNonSharedNode;
- LayoutPoint m_point;
LayoutPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
// determine where inside the renderer we hit on subsequent operations.
RefPtr<Element> m_innerURLElement;
RefPtr<Scrollbar> m_scrollbar;
bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example).
- bool m_isRectBased;
- int m_topPadding;
- int m_rightPadding;
- int m_bottomPadding;
- int m_leftPadding;
+
ShadowContentFilterPolicy m_shadowContentFilterPolicy;
-
+
RenderRegion* m_region; // The region we're inside.
mutable OwnPtr<NodeSet> m_rectBasedTestResult;
@@ -162,7 +184,7 @@ private:
// y = p.y() - topPadding
// width = leftPadding + rightPadding + 1
// height = topPadding + bottomPadding + 1
-inline IntRect HitTestResult::rectForPoint(const LayoutPoint& point) const
+inline IntRect HitTestPoint::rectForPoint(const LayoutPoint& point) const
{
return rectForPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
}