[webkit-dev] Changing API for Document::nodesFromRect
tonikitoo at gmail.com
Wed Sep 22 21:15:12 PDT 2010
A few months back, http://trac.webkit.org/changeset/64272 added
Document::nodesFromRect as a convenient interface for the rect-based
hit testing extension (also added in the same checkin). The intention
behind this checkin is to enable WebKit to enlarge the target area of
mouse events, by building up a fuzzy rectangular area to be processed
by the engine while hit testing, which can be specially useful for
As is today, the method signature looks like this: void
nodesFromRect(int x, int y, int horizontalPadding, int
verticalPadding). Basically, the rectangular area to be processed by
the engine is built up using the original event position as its center
point (x and y), expanding it by the given paddings for each
orientation (vertical and horizontal).
Empirical results from testing the use of nodesFromRect in capacitive
touch screens showed us that users tend to tap below elements. So for
even more accurate results (which means pleasant tapping experience),
it makes sense to use a region that is offset more above the touch
point, favoring elements above the touch point.
The Mozilla mobile team also had the same feeling (as described in
) and adjusted their nodesFromRect API accordingly by making it
possible to specify different offset for each direction (top, right,
bottom, left). I propose we to follow their more flexible approach:
method signature would change to RefPtr<NodeList> nodesFromRect(int x,
int y, int top, int right, int bottom, int left).
Whoever still want to share the same value for vertical offsets will
be happy, and who want it more flexible will also be happy.
Filed bug https://bugs.webkit.org/show_bug.cgi?id=46336 about that.
More information about the webkit-dev