Enable synthesizeDragStart to specify coordinates

RESOLVED FIXED in mozilla1.9.3a5

Status

Testing
Mochitest
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: InvisibleSmiley, Assigned: InvisibleSmiley)

Tracking

Trunk
mozilla1.9.3a5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

8 years ago
Created attachment 434310 [details] [diff] [review]
patch

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 1

8 years ago
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).
(Assignee)

Comment 2

8 years ago
Created attachment 434568 [details] [diff] [review]
patch v2

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)

Updated

8 years ago
Attachment #434568 - Flags: review?(enndeakin) → review+
(Assignee)

Updated

8 years ago
Summary: Enable synthesizeDragStart and synthesizeDrop to specify coordinates and stepping → Enable synthesizeDragStart to specify coordinates
(Assignee)

Updated

8 years ago
Keywords: checkin-needed
Pushed as: http://hg.mozilla.org/mozilla-central/rev/09a3a8d02702
Status: ASSIGNED → RESOLVED
Last Resolved: 8 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.