summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/HitTestResult.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/rendering/HitTestResult.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/rendering/HitTestResult.cpp')
-rw-r--r--Source/WebCore/rendering/HitTestResult.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp
index dc987c802..c19f1222f 100644
--- a/Source/WebCore/rendering/HitTestResult.cpp
+++ b/Source/WebCore/rendering/HitTestResult.cpp
@@ -54,6 +54,7 @@ HitTestResult::HitTestResult()
, m_rightPadding(0)
, m_bottomPadding(0)
, m_leftPadding(0)
+ , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
, m_region(0)
{
}
@@ -66,17 +67,19 @@ HitTestResult::HitTestResult(const LayoutPoint& point)
, m_rightPadding(0)
, m_bottomPadding(0)
, m_leftPadding(0)
+ , m_shadowContentFilterPolicy(DoNotAllowShadowContent)
, m_region(0)
{
}
-HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding, ShadowContentFilterPolicy allowShadowContent)
: m_point(centerPoint)
, m_isOverWidget(false)
, m_topPadding(topPadding)
, m_rightPadding(rightPadding)
, m_bottomPadding(bottomPadding)
, m_leftPadding(leftPadding)
+ , m_shadowContentFilterPolicy(allowShadowContent)
, m_region(0)
{
// If all padding values passed in are zero then it is not a rect based hit test.
@@ -95,6 +98,7 @@ HitTestResult::HitTestResult(const HitTestResult& other)
, m_innerURLElement(other.URLElement())
, m_scrollbar(other.scrollbar())
, m_isOverWidget(other.isOverWidget())
+ , m_shadowContentFilterPolicy(other.shadowContentFilterPolicy())
, m_region(other.region())
{
// Only copy the padding and NodeSet in case of rect hit test.
@@ -134,7 +138,8 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
m_topPadding = m_rightPadding = m_bottomPadding = m_leftPadding = 0;
m_rectBasedTestResult = adoptPtr(other.m_rectBasedTestResult ? new NodeSet(*other.m_rectBasedTestResult) : 0);
-
+ m_shadowContentFilterPolicy = other.shadowContentFilterPolicy();
+
m_region = other.m_region;
return *this;
@@ -572,7 +577,9 @@ bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint&
if (!node)
return true;
- node = node->shadowAncestorNode();
+ if (m_shadowContentFilterPolicy == DoNotAllowShadowContent)
+ node = node->shadowAncestorNode();
+
mutableRectBasedTestResult().add(node);
if (node->renderer()->isInline()) {
@@ -603,7 +610,9 @@ bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint&
if (!node)
return true;
- node = node->shadowAncestorNode();
+ if (m_shadowContentFilterPolicy == DoNotAllowShadowContent)
+ node = node->shadowAncestorNode();
+
mutableRectBasedTestResult().add(node);
if (node->renderer()->isInline()) {
@@ -643,16 +652,16 @@ void HitTestResult::append(const HitTestResult& other)
}
}
-LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+IntRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
{
- LayoutPoint actualPoint(point);
- actualPoint -= LayoutSize(leftPadding, topPadding);
+ IntPoint actualPoint(roundedIntPoint(point));
+ actualPoint -= IntSize(leftPadding, topPadding);
IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
// As IntRect is left inclusive and right exclusive (seeing IntRect::contains(x, y)), adding "1".
actualPadding += IntSize(1, 1);
- return LayoutRect(actualPoint, actualPadding);
+ return IntRect(actualPoint, actualPadding);
}
const HitTestResult::NodeSet& HitTestResult::rectBasedTestResult() const