Bug 29219 - Document.elementFromPoint() should take page scroll into consideration
Summary: Document.elementFromPoint() should take page scroll into consideration
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2009-09-11 18:30 PDT by Xiaomei Ji
Modified: 2009-09-15 21:49 PDT (History)
4 users (show)

See Also:

patch (8.35 KB, patch)
2009-09-12 01:59 PDT, Sam Weinig
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xiaomei Ji 2009-09-11 18:30:37 PDT
I am not sure whether this is a bug or not.

document.elementFromPoint() currently does not take page scroll into consideration.
If the input parameter (x, y) is the point in viewport, it should be increased by (document.body.scrollLeft, document.body.scrollTop), then apply zoomFactor, in order to get the correct point in the document.

Or it is expected user to pass in (x, y) with scoll offset, such as 
(event.clientX + document.body.scrollLeft, event.clientY + document.body.scrollTop)?
Comment 1 Sam Weinig 2009-09-11 19:00:12 PDT
Can you gather stats on what the other browsers do?
Comment 2 Sam Weinig 2009-09-12 01:16:00 PDT
My experiments show that Firefox behaves as the spec describes, and I don't believe IE implements this API.  We should probably change.
Comment 3 Sam Weinig 2009-09-12 01:24:50 PDT
I take it back, IE implements it, but I don't have a windows machine to test on at the moment.
Comment 4 Sam Weinig 2009-09-12 01:59:28 PDT
Created attachment 39511 [details]
Comment 5 Anders Carlsson 2009-09-12 10:33:41 PDT
Comment on attachment 39511 [details]

Comment 6 Sam Weinig 2009-09-12 12:12:38 PDT
Fixed in r48334.
Comment 7 Mark Rowe (bdash) 2009-09-15 21:49:48 PDT
This broke dragging files on to file inputs: bug 29276.