[webkit-dev] Changing API for Document::nodesFromRect
Antonio Gomes
tonikitoo at gmail.com
Wed Sep 22 21:15:12 PDT 2010
Hi all.
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
touch devices.
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
[1]) 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.
[1] http://starkravingfinkle.org/blog/2010/05/smart-tapping-in-mobile-firefox/
[2] http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/base/nsIDOMWindowUtils.idl#416
--
--Antonio Gomes
More information about the webkit-dev
mailing list