Closed Bug 463104 Opened 16 years ago Closed 14 years ago

elementFromPoint should take floating-point coords

Categories

(Core :: DOM: CSS Object Model, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a4

People

(Reporter: bzbarsky, Assigned: emk)

Details

Attachments

(1 file, 2 obsolete files)

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
Attached patch patch (obsolete) — Splinter Review
changing elementFromPoint arguments to float
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Attachment #436835 - Flags: review?(bzbarsky)
Attached patch patch v1.1 (obsolete) — Splinter Review
Forgotten to add a test file to Makefile.in
Attachment #436835 - Attachment is obsolete: true
Attachment #436836 - Flags: review?(bzbarsky)
Attachment #436835 - Flags: review?(bzbarsky)
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+.
Attachment #436836 - Attachment is obsolete: true
Attachment #436838 - Flags: review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/50b933e7db8e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Keywords: checkin-needed
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.

Attachment

General

Created:
Updated:
Size: