[webkit-dev] Proposal: Rect based HitTest for a better touch experience
Antonio Gomes (:tonikitoo)
tonikitoo at gmail.com
Mon Jul 5 19:35:34 PDT 2010
Hi guys.
We've uploaded a patch for review in bug
https://bugs.webkit.org/show_bug.cgi?id=40197 (attachment
https://bugs.webkit.org/attachment.cgi?id=59789 - chromium build fixed
in r61955) - Grace and I joint effort in fixing this issue.
As ways to expose the functionality, the patch:
* extends hitTestResultAtPoint method of the EventHandler with an
extra 'padding' parameter, defaulting to IntSize(0,0). The rect-based
hit test is performed when a non-zero padding is passed in;
* adds a Document::nodesFromRect method, exposing the functionality to
the dom. It returns a NodeList with all nodes that intersect the given
hit-tested area.
I would like to discuss how the later should work.
As-is nodesFromRect will be store all nodes whose area intersects the
given rect hit test 'til it finds a node whose boundary encloses it
completely. At this point hit test will stop at any node in the tree
hierarchy. Sample outputs of nodesFromRect for an hypothetical rect X
and a html Y are [<p> , <div>, <body>]. For another hypothetical rect
Z and the same html Y, nodesFromRect might return [<span>,<div>].
In the later sample output, note that it did not reach <body> , whose
boundary obvious intersects any possible given Z rect. That would
happen if the <div> in case encloses the rect Z completely, and it
would be the stop point for the hit test.
In Mozilla's implementation, nodesFromRect does not care if a node
encloses the hit test rect completely or partially. The test will
continue until the <body>.
What would be the preferable behavior for our implementation?
Cheers,
--Antonio
More information about the webkit-dev
mailing list