[Webkit-unassigned] [Bug 40197] Enhance the hit testing to take a rectangle instead of a point

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 6 22:56:01 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=40197





--- Comment #35 from Antonio Gomes <tonikitoo at webkit.org>  2010-07-06 22:55:59 PST ---
So I have one pending issue before uploading a newer version of the patch.

The point is: in the current hit test implementation (point based) the logic is that it performs the hit test in a top-down recursive way (from higher to lower layers), and "stops" when the hit test point is contained by a RenderXXX area. 

For example, @nodeAtPoint from RenderBox.cpp: 

...
// Check our bounds next. For this purpose always assume that we can only be hit in the
// foreground phase (which is true for replaced elements like images).
if ( ... && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) {
    updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty));
    return true;
}
...

Note the use of "contains". If the hit point is is contained by the current node boundary, hit test stops (returns 'true'), it is a success and the current node() is the hit one!

However for the rect based hit test, we can not just return true if hit test rect intersects the boundary of the current node being tested. Reason: we have to continue hit testing to see if it intersecs other nodes. So we return  normally false. (the exception is when the hit test rect is fully enclosed by
the node being tested, when then true is returned and the hit test stops).

The problem is that in RenderLayer::hitTestContests we have

bool RenderLayer::hitTestContents(...)
{
  if (!renderer()->hitTest(request, result, hitTestPoint,
                          layerBounds.x() - renderBoxX(),
                          layerBounds.y() - renderBoxY(), 
                          hitTestFilter)) {
      // It's wrong to set innerNode, but then claim that you didn't hit anything.
      ASSERT(!result.innerNode());
      return false;
  }
  ...
}

this ASSERT controverses the rect-based hit test, once we in such mode,  returning 'false' does not necesseraly mean that nothing was hit.

Would it make sense to modify the assert condition, so we do not hit that?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list