[webkit-dev] Proposal: Rect based HitTest for a better touch experience

Antonio Gomes (:tonikitoo) tonikitoo at gmail.com
Wed Jul 7 05:59:45 PDT 2010


>>>> 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?
>>>
>>> The latter behavior may actually make the method useful for things other
>>> than hit testing, if that sways your decision at all. I can imagine page
>>> authors finding it useful to be able to find out all the elements that are under
>>> a given point (which in turn suggests that elementsFromRect with zero padding
>>> should still find all the hit elements in z-order).
>>
>> Exactly the point. For hit test matters, stopping as soon as it gets
>> fully enclosed makes total sense to me. On the other hand, as you
>> said, I bet there might be use cases like "give me all nodes under X,
>> Y, with padding W, H" (where they can be '0'). I thought about making
>> this "stop" an optional flag for HitTestResult or HitTestRequest.
>> Would it be acceptable?
>
> I'd resist adding this until we have a use case for it.

Maybe you've already have a internal use case (see below :)

Jun 16 18:04:01 <dhyatt>	tonikitoo: i need to talk to some people here
at apple too
Jun 16 18:04:12 <dhyatt>	tonikitoo: we've gotten a request for e.g.,
all the nodes that intersect the visible rect
Jun 16 18:04:16 <dhyatt>	that's a common desire
Jun 16 18:04:20 <dhyatt>	this api kind of does that
Jun 16 18:04:29 <dhyatt>	i think other browsers would be interested too etc

It would be great it we could use this opportunity to address this
request. But, well, in order to make it work that way ("give *all*
nodes under rect X"), there would be some less simple changes needed,
so we can go first for with what we have working at the moment.

Cheers,

-- 
--Antonio Gomes


More information about the webkit-dev mailing list