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/rendering/RenderTable.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'WebCore/rendering/RenderTable.cpp') diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 0a61a93..eac5c5d 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -31,6 +31,9 @@ #include "Document.h" #include "FixedTableLayout.h" #include "FrameView.h" +#ifdef ANDROID_HITTEST_WITHSIZE +#include "HitTestResult.h" +#endif #include "HTMLNames.h" #include "RenderLayer.h" #include "RenderTableCell.h" @@ -1202,7 +1205,11 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu ty += y(); // Check kids first. +#ifdef ANDROID_HITTEST_WITHSIZE + if (!hasOverflowClip() || result.intersects(xPos, yPos, overflowClipRect(tx, ty))) { +#else if (!hasOverflowClip() || overflowClipRect(tx, ty).contains(xPos, yPos)) { +#endif for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { @@ -1213,8 +1220,21 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } // Check our bounds next. +#ifdef ANDROID_HITTEST_WITHSIZE + IntRect boundsRect = IntRect(tx, ty, width(), height()); + if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && result.intersects(xPos, yPos, boundsRect)) { +#else if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { +#endif updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); +#ifdef ANDROID_HITTEST_WITHSIZE + if (result.isRegionTest()) { + ASSERT(node() || isAnonymous()); + result.addRawNode(node()); + if (!result.containedBy(xPos, yPos, boundsRect)) + return false; + } +#endif return true; } -- cgit v1.1