From def249c77d8bb3dbfc4daaf749262789d0055ae2 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Sat, 2 Apr 2016 10:30:30 -0700 Subject: [PATCH] Bug 1251905, part 3 - Make prepareScrollUnits() support APZ using the async synthetic wheel event. r=masayuki --- .../test/test_continuous_wheel_events.html | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/dom/events/test/test_continuous_wheel_events.html b/dom/events/test/test_continuous_wheel_events.html index e0eed656955e..7e6ee4acfe2b 100644 --- a/dom/events/test/test_continuous_wheel_events.html +++ b/dom/events/test/test_continuous_wheel_events.html @@ -4,6 +4,7 @@ Test for D3E WheelEvent + @@ -55,7 +56,12 @@ var gHorizontalLine = 0; var gPageHeight = 0; var gPageWidth = 0; -function prepareScrollUnits() +function sendWheelAndWait(aX, aY, aEvent) +{ + sendWheelAndPaint(gScrollableElement, aX, aY, aEvent, continueTest); +} + +function* prepareScrollUnits() { var result = -1; function handler(aEvent) @@ -65,32 +71,32 @@ function prepareScrollUnits() } window.addEventListener("MozMousePixelScroll", handler, true); - synthesizeWheel(gScrollableElement, 10, 10, - { deltaMode: WheelEvent.DOM_DELTA_LINE, - deltaY: 1.0, lineOrPageDeltaY: 1 }); + yield sendWheelAndWait(10, 10, + { deltaMode: WheelEvent.DOM_DELTA_LINE, + deltaY: 1.0, lineOrPageDeltaY: 1 }); gLineHeight = result; ok(gLineHeight > 10 && gLineHeight < 25, "prepareScrollUnits: gLineHeight may be illegal value, got " + gLineHeight); result = -1; - synthesizeWheel(gScrollableElement, 10, 10, - { deltaMode: WheelEvent.DOM_DELTA_LINE, - deltaX: 1.0, lineOrPageDeltaX: 1 }); + yield sendWheelAndWait(10, 10, + { deltaMode: WheelEvent.DOM_DELTA_LINE, + deltaX: 1.0, lineOrPageDeltaX: 1 }); gHorizontalLine = result; ok(gHorizontalLine > 5 && gHorizontalLine < 16, "prepareScrollUnits: gHorizontalLine may be illegal value, got " + gHorizontalLine); result = -1; - synthesizeWheel(gScrollableElement, 10, 10, - { deltaMode: WheelEvent.DOM_DELTA_PAGE, - deltaY: 1.0, lineOrPageDeltaY: 1 }); + yield sendWheelAndWait(10, 10, + { deltaMode: WheelEvent.DOM_DELTA_PAGE, + deltaY: 1.0, lineOrPageDeltaY: 1 }); gPageHeight = result; // XXX Cannot we know the actual scroll port size? ok(gPageHeight >= 150 && gPageHeight <= 200, "prepareScrollUnits: gPageHeight is strange value, got " + gPageHeight); result = -1; - synthesizeWheel(gScrollableElement, 10, 10, - { deltaMode: WheelEvent.DOM_DELTA_PAGE, - deltaX: 1.0, lineOrPageDeltaX: 1 }); + yield sendWheelAndWait(10, 10, + { deltaMode: WheelEvent.DOM_DELTA_PAGE, + deltaX: 1.0, lineOrPageDeltaX: 1 }); gPageWidth = result; ok(gPageWidth >= 150 && gPageWidth <= 200, "prepareScrollUnits: gPageWidth is strange value, got " + gPageWidth); @@ -3196,7 +3202,7 @@ function continueTest() function* testBody() { - prepareScrollUnits(); + yield* prepareScrollUnits(); testContinuousTrustedEvents(); }