--- a/testing/mochitest/tests/SimpleTest/EventUtils.js
+++ b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -6,16 +6,17 @@
* sendChar
* sendString
* sendKey
* sendWheelAndPaint
* synthesizeMouse
* synthesizeMouseAtCenter
* synthesizePointer
* synthesizeWheel
+ * synthesizeWheelAtPoint
* synthesizeKey
* synthesizeNativeKey
* synthesizeMouseExpectEvent
* synthesizeKeyExpectEvent
* synthesizeNativeClick
*
* When adding methods to this file, please add a performance test for it.
*/
@@ -401,34 +402,33 @@ function synthesizeMouseAtCenter(aTarget
function synthesizeTouchAtCenter(aTarget, aEvent, aWindow)
{
var rect = aTarget.getBoundingClientRect();
synthesizeTouch(aTarget, rect.width / 2, rect.height / 2, aEvent,
aWindow);
}
/**
- * Synthesize a wheel event on a target. The actual client point is determined
- * by taking the aTarget's client box and offseting it by aOffsetX and
- * aOffsetY.
+ * Synthesize a wheel event without flush layout at a particular point in
+ * aWindow.
*
* aEvent is an object which may contain the properties:
* shiftKey, ctrlKey, altKey, metaKey, accessKey, deltaX, deltaY, deltaZ,
* deltaMode, lineOrPageDeltaX, lineOrPageDeltaY, isMomentum,
* isNoLineOrPageDelta, isCustomizedByPrefs, expectedOverflowDeltaX,
* expectedOverflowDeltaY
*
* deltaMode must be defined, others are ok even if undefined.
*
* expectedOverflowDeltaX and expectedOverflowDeltaY take integer value. The
* value is just checked as 0 or positive or negative.
*
* aWindow is optional, and defaults to the current window object.
*/
-function synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
+function synthesizeWheelAtPoint(aLeft, aTop, aEvent, aWindow)
{
var utils = _getDOMWindowUtils(aWindow);
if (!utils) {
return;
}
var modifiers = _parseModifiers(aEvent);
var options = 0;
@@ -475,25 +475,48 @@ function synthesizeWheel(aTarget, aOffse
var lineOrPageDeltaX =
aEvent.lineOrPageDeltaX != null ? aEvent.lineOrPageDeltaX :
aEvent.deltaX > 0 ? Math.floor(aEvent.deltaX) :
Math.ceil(aEvent.deltaX);
var lineOrPageDeltaY =
aEvent.lineOrPageDeltaY != null ? aEvent.lineOrPageDeltaY :
aEvent.deltaY > 0 ? Math.floor(aEvent.deltaY) :
Math.ceil(aEvent.deltaY);
-
- var rect = aTarget.getBoundingClientRect();
- utils.sendWheelEvent(rect.left + aOffsetX, rect.top + aOffsetY,
+ utils.sendWheelEvent(aLeft, aTop,
aEvent.deltaX, aEvent.deltaY, aEvent.deltaZ,
aEvent.deltaMode, modifiers,
lineOrPageDeltaX, lineOrPageDeltaY, options);
}
/**
+ * Synthesize a wheel event on a target. The actual client point is determined
+ * by taking the aTarget's client box and offseting it by aOffsetX and
+ * aOffsetY.
+ *
+ * aEvent is an object which may contain the properties:
+ * shiftKey, ctrlKey, altKey, metaKey, accessKey, deltaX, deltaY, deltaZ,
+ * deltaMode, lineOrPageDeltaX, lineOrPageDeltaY, isMomentum,
+ * isNoLineOrPageDelta, isCustomizedByPrefs, expectedOverflowDeltaX,
+ * expectedOverflowDeltaY
+ *
+ * deltaMode must be defined, others are ok even if undefined.
+ *
+ * expectedOverflowDeltaX and expectedOverflowDeltaY take integer value. The
+ * value is just checked as 0 or positive or negative.
+ *
+ * aWindow is optional, and defaults to the current window object.
+ */
+function synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
+{
+ var rect = aTarget.getBoundingClientRect();
+ synthesizeWheelAtPoint(rect.left + aOffsetX, rect.top + aOffsetY,
+ aEvent, aWindow);
+}
+
+/**
* This is a wrapper around synthesizeWheel that waits for the wheel event
* to be dispatched and for the subsequent layout/paints to be flushed.
*
* This requires including paint_listener.js. Tests must call
* DOMWindowUtils.restoreNormalRefresh() before finishing, if they use this
* function.
*
* If no callback is provided, the caller is assumed to have its own method of