Open
Bug 1126772
Opened 11 years ago
Updated 3 years ago
Add function to EventUtils.js that wraps sendNativeMouseEvent
Categories
(Testing :: Mochitest, defect)
Tracking
(Not tracked)
NEW
People
(Reporter: enndeakin, Unassigned)
References
(Depends on 2 open bugs)
Details
Several tests are using sendNativeMouseEvent and need to manually compute the right arguments to use. Remove all of this and create a function in EventUtils that does this.
Comment 1•7 years ago
|
||
I'd say we should consolidate EventUtils functions, as there's a _lot_ of redundancy there, with the multiplication of functions for event type, AtPoint, AtCenter, native, non-native, and so on.
Most function variations just repeat the same calculations. We can instead have one function like:
EventUtils.synthesize({
type: "click", // Mandatory, like "mousemove", "keypress", "keyup", and so on, same for supported native events
element, // Mandatory for mouse/touch events, may be used to focus controls for key events
selector, // Alternative to "element"
window, // Optional, but always or almost always we can just use element.ownerGlobal
key, // Only for key events
x, // Offset for mouse/touch events, or horizontal center of element when === undefined
y, // Offset for mouse/touch events, or vertical center of element when === undefined
noFlush: false, // Optional to use getBoundsWithoutFlushing, default to false for compatibility
native: false, // The screenPixelsPerCSSPixel and mozInnerScreenX/Y computation is the same for all events
...
});
We my keep existing EventUtils wrappers for a while but remove them eventually.
Another advantage is that we only need one "BrowserTestUtils.synthesizeContentEvent" function instead of several variations. This could simply take the "selector" version with an additional "browser" parameter, and just forward the rest of the arguments verbatim to the content process through message passing.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•