Bug 884796 - Scale deltas in EventUtils.js::synthesizeWheel() on HiDPI screens r=robcee

This commit is contained in:
Michael Ratcliffe 2014-03-06 09:38:09 +00:00
parent 1b2b3fdef8
commit 082d2b47aa
2 changed files with 7 additions and 2 deletions

View File

@ -42,8 +42,6 @@ function inspectNode(aInspector)
function performScrollingTest()
{
executeSoon(function() {
// FIXME: this will fail on retina displays. EventUtils will only scroll
// 25px down instead of 50.
EventUtils.synthesizeWheel(div, 10, 10,
{ deltaY: 50.0, deltaMode: WheelEvent.DOM_DELTA_PIXEL },
iframe.contentWindow);

View File

@ -412,6 +412,13 @@ function synthesizeWheel(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
aEvent.deltaY > 0 ? Math.floor(aEvent.deltaY) :
Math.ceil(aEvent.deltaY);
if (aEvent.deltaMode === WheelEvent.DOM_DELTA_PIXEL)
{
aEvent.deltaX *= devicePixelRatio;
aEvent.deltaY *= devicePixelRatio;
aEvent.deltaZ *= devicePixelRatio;
}
var rect = aTarget.getBoundingClientRect();
utils.sendWheelEvent(rect.left + aOffsetX, rect.top + aOffsetY,
aEvent.deltaX, aEvent.deltaY, aEvent.deltaZ,