As things stand, elementFromPoint can lie about the element when something other than a DOM event is used to determine the point. This could be fixed by changing to floating-point coords, which would allow sub-CSS-px points.
This method is no longer a Mozilla Extension. It's defined in CSSOM View working draft. Per CSSOM View, elementFromPoint should take floating-point coordinates. http://www.w3.org/TR/cssom-view/#the-documentview-interface Moreover, getBoundingClientRect() already returns floating-point coordinates. Therefore var rect = elem.getBoundingClientRect(); elem === document.elementFromPoint(rect.left, rect.top); will return false incorrectly if the element has sub-CSS-px points.
Component: DOM: Mozilla Extensions → DOM: CSS Object Model
OS: Mac OS X → All
changing elementFromPoint arguments to float
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Attachment #436835 - Flags: review?(bzbarsky)
Forgotten to add a test file to Makefile.in
Comment on attachment 436836 [details] [diff] [review] patch v1.1 The test strings should be "a shouldn't be found" and "a should be found". With that, r=bzbarsky.
Attachment #436836 - Flags: review?(bzbarsky) → review+
Fixed test strings. Carrying forward r+.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a4
The test had: isnot(a, document.elementFromPoint(5.5, 5.5), "a should be found"); isnot(a, document.elementFromPoint(5.75, 5.75), "a should be found"); I believe these are incorrect, they should both return "a". I fixed that in bug 646757.
Sorry, the original test lines were of course isnot(a, document.elementFromPoint(5.5, 5.5), "a shouldn't be found"); isnot(a, document.elementFromPoint(5.75, 5.75), "a shouldn't be found");
You need to log in before you can comment on or make changes to this bug.