summaryrefslogtreecommitdiffstats
path: root/WebCore/page
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2010-05-18 21:59:53 -0700
committerGrace Kloba <klobag@google.com>2010-05-24 21:41:25 -0700
commit17dcead8ee9edfa8f75e7e2d2284ed3c6f4bd403 (patch)
tree8d89d459030792e918c95900963217ec89287eab /WebCore/page
parent40a65b8dda8d56276893edcc25c957d13b3a9b77 (diff)
downloadexternal_webkit-17dcead8ee9edfa8f75e7e2d2284ed3c6f4bd403.zip
external_webkit-17dcead8ee9edfa8f75e7e2d2284ed3c6f4bd403.tar.gz
external_webkit-17dcead8ee9edfa8f75e7e2d2284ed3c6f4bd403.tar.bz2
First draft to add a fat point to WebKit hit test.
If padding is 0, it is the old style point hit test. If it finds a node, it will break the search loop and return. If padding is non-zero, the first node will be added to HitTestResult's innerNode as before. But instead of finishing the search, hit test will continue to look for other nodes covered by the fat point unless it is fully inside the current node. Here are some highlights of the changes. . instead of testing renderRect.contains(x, y), we now test renderRect.intersect(pointRect) . when a Node is hit, it will be appended to the rawNodeList of HitTestResult. So the order inside the rawNodeList represents the hit test order. Currently the fat point doesn't support SVG nodes. It also doesn't support overflow control yet.
Diffstat (limited to 'WebCore/page')
-rw-r--r--WebCore/page/EventHandler.cpp12
-rw-r--r--WebCore/page/EventHandler.h4
2 files changed, 16 insertions, 0 deletions
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 8f63144..042f3d4 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -865,9 +865,17 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const
}
#endif // ENABLE(DRAG_SUPPORT)
+#ifdef ANDROID_HITTEST_WITHSIZE
+HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, const IntSize& pointPadding)
+#else
HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars)
+#endif
{
+#ifdef ANDROID_HITTEST_WITHSIZE
+ HitTestResult result(point, pointPadding);
+#else
HitTestResult result(point);
+#endif
if (!m_frame->contentRenderer())
return result;
int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
@@ -889,7 +897,11 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all
FrameView* view = static_cast<FrameView*>(widget);
IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(),
result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop());
+#ifdef ANDROID_HITTEST_WITHSIZE
+ HitTestResult widgetHitTestResult(widgetPoint, pointPadding);
+#else
HitTestResult widgetHitTestResult(widgetPoint);
+#endif
frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult);
result = widgetHitTestResult;
diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h
index c83925c..39b165d 100644
--- a/WebCore/page/EventHandler.h
+++ b/WebCore/page/EventHandler.h
@@ -105,7 +105,11 @@ public:
void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&);
+#ifdef ANDROID_HITTEST_WITHSIZE
+ HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, const IntSize& pointPadding = IntSize());
+#else
HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars);
+#endif
bool mousePressed() const { return m_mousePressed; }
void setMousePressed(bool pressed) { m_mousePressed = pressed; }