Closed Bug 554418 Opened 14 years ago Closed 14 years ago

Enable synthesizeDragStart to specify coordinates

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: InvisibleSmiley, Assigned: InvisibleSmiley)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Currently synthesizeDragStart and synthesizeDrop hard-code the coordinates and coordinate stepping to be used (2, +9). This may be fine for the elements they are currently used for (e.g. Firefox Download Manager richlistitems) but it's not flexible enough for other cases, e.g. trees (see below). synthesizeMouse OTOH allows to specify x and y coordinates. The drag&drop functions should optionally allow that, too. Specifying the stepping should probably also be allowed for complete flexibility.

Concerning the tree use case:
Tree contents are created dynamically. Tree rows and cells cannot be accessed directly using getElementById (because they do not exist as actual elements in the first place). However, cell coordinates can be found through tree.treeBoxObject.getCoordsForCellItem. If the drag&drop test functions can be passed these coordinates, drag&drop can be tested in trees.

Example: bug 192728 (SM port of FF bug 462172) needs a test. Unlike the FF Download Manager, SM's Download Manager is tree-based. Thus the above requirement. I already have a test for bug 192728 ready, but this one blocks it.

Attached you'll find a patch that implements my suggestion. All additions are optional so existing callers need not be adapted. I included some cleanup since the parameter ordering in the comments was partially wrong.
Attachment #434310 - Flags: review?(enndeakin)
Comment on attachment 434310 [details] [diff] [review]
patch

You shouldn't need to change synthesizeDrop; the synthesized mouse events are only used to get a useful 'dataTransfer' object to pass to the other drag events.

Also, the 'step' argument shouldn't be needed. The threshold to start a drag is the same for all elements (5 or 8 pixels depending on platform).
Attached patch patch v2Splinter Review
Addressed review comments (thanks!)
Assignee: nobody → jh
Attachment #434310 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #434568 - Flags: review?(enndeakin)
Attachment #434310 - Flags: review?(enndeakin)
Attachment #434568 - Flags: review?(enndeakin) → review+
Summary: Enable synthesizeDragStart and synthesizeDrop to specify coordinates and stepping → Enable synthesizeDragStart to specify coordinates
Keywords: checkin-needed
Pushed as: http://hg.mozilla.org/mozilla-central/rev/09a3a8d02702
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: