From 17dcead8ee9edfa8f75e7e2d2284ed3c6f4bd403 Mon Sep 17 00:00:00 2001 From: Grace Kloba Date: Tue, 18 May 2010 21:59:53 -0700 Subject: 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. --- WebCore/page/EventHandler.cpp | 12 ++++++++++++ WebCore/page/EventHandler.h | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'WebCore/page') 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(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; } -- cgit v1.1