зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1661897) for mochitest failures on test_group_mouseevents.html . CLOSED TREE
Backed out changeset 34ee0403ab1e (bug 1661897) Backed out changeset f83db4b41bf6 (bug 1661897)
This commit is contained in:
Родитель
f16141c258
Коммит
b4560d9e94
|
@ -583,13 +583,6 @@ function synthesizeNativeMouseEvent(aTarget, aX, aY, aType, aObserver = null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Promise-returning variant of synthesizeNativeMouseEvent
|
|
||||||
function promiseNativeMouseEvent(aTarget, aX, aY, aType) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
synthesizeNativeMouseEvent(aTarget, aX, aY, aType, resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function synthesizeNativeClick(aElement, aX, aY, aObserver = null) {
|
function synthesizeNativeClick(aElement, aX, aY, aObserver = null) {
|
||||||
var pt = coordinatesRelativeToScreen(aX, aY, aElement);
|
var pt = coordinatesRelativeToScreen(aX, aY, aElement);
|
||||||
var utils = SpecialPowers.getDOMWindowUtils(
|
var utils = SpecialPowers.getDOMWindowUtils(
|
||||||
|
@ -652,8 +645,7 @@ function moveMouseAndScrollWheelOver(
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
testDriver,
|
testDriver,
|
||||||
waitForScroll = true,
|
waitForScroll = true
|
||||||
scrollDelta = 10
|
|
||||||
) {
|
) {
|
||||||
return synthesizeNativeMouseMoveAndWaitForMoveEvent(
|
return synthesizeNativeMouseMoveAndWaitForMoveEvent(
|
||||||
target,
|
target,
|
||||||
|
@ -666,7 +658,7 @@ function moveMouseAndScrollWheelOver(
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
0,
|
0,
|
||||||
-scrollDelta,
|
-10,
|
||||||
testDriver
|
testDriver
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -675,7 +667,7 @@ function moveMouseAndScrollWheelOver(
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
0,
|
0,
|
||||||
-scrollDelta,
|
-10,
|
||||||
testDriver
|
testDriver
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -690,18 +682,10 @@ function promiseMoveMouseAndScrollWheelOver(
|
||||||
target,
|
target,
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
waitForScroll = true,
|
waitForScroll = true
|
||||||
scrollDelta = 10
|
|
||||||
) {
|
) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
moveMouseAndScrollWheelOver(
|
moveMouseAndScrollWheelOver(target, dx, dy, resolve, waitForScroll);
|
||||||
target,
|
|
||||||
dx,
|
|
||||||
dy,
|
|
||||||
resolve,
|
|
||||||
waitForScroll,
|
|
||||||
scrollDelta
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,75 +776,6 @@ function* dragVerticalScrollbar(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synthesizes a native mouse drag, starting at offset (mouseX, mouseY) from
|
|
||||||
// the given target. The drag occurs in the given number of steps, to a final
|
|
||||||
// destination of (mouseX + distanceX, mouseY + distanceY) from the target.
|
|
||||||
// Returns a promise (wrapped in a function, so it doesn't execute immediately)
|
|
||||||
// that should be awaited after the mousemoves have been processed by the widget
|
|
||||||
// code, to end the drag. This is important otherwise the OS can sometimes
|
|
||||||
// reorder the events and the drag doesn't have the intended effect (see
|
|
||||||
// bug 1368603).
|
|
||||||
// Example usage:
|
|
||||||
// let dragFinisher = await promiseNativeMouseDrag(myElement, 0, 0);
|
|
||||||
// await myIndicationThatDragHadAnEffect;
|
|
||||||
// await dragFinisher();
|
|
||||||
async function promiseNativeMouseDrag(
|
|
||||||
target,
|
|
||||||
mouseX,
|
|
||||||
mouseY,
|
|
||||||
distanceX = 20,
|
|
||||||
distanceY = 20,
|
|
||||||
steps = 20
|
|
||||||
) {
|
|
||||||
var targetElement = elementForTarget(target);
|
|
||||||
dump(
|
|
||||||
"Starting drag at " +
|
|
||||||
mouseX +
|
|
||||||
", " +
|
|
||||||
mouseY +
|
|
||||||
" from top-left of #" +
|
|
||||||
targetElement.id +
|
|
||||||
"\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Move the mouse to the target position
|
|
||||||
await promiseNativeMouseEvent(
|
|
||||||
target,
|
|
||||||
mouseX,
|
|
||||||
mouseY,
|
|
||||||
nativeMouseMoveEventMsg()
|
|
||||||
);
|
|
||||||
// mouse down
|
|
||||||
await promiseNativeMouseEvent(
|
|
||||||
target,
|
|
||||||
mouseX,
|
|
||||||
mouseY,
|
|
||||||
nativeMouseDownEventMsg()
|
|
||||||
);
|
|
||||||
// drag vertically by |increment| until we reach the specified distance
|
|
||||||
for (var s = 1; s <= steps; s++) {
|
|
||||||
let dx = distanceX * (s / steps);
|
|
||||||
let dy = distanceY * (s / steps);
|
|
||||||
dump(`Dragging to ${mouseX + dx}, ${mouseY + dy} from target\n`);
|
|
||||||
await promiseNativeMouseEvent(
|
|
||||||
target,
|
|
||||||
mouseX + dx,
|
|
||||||
mouseY + dy,
|
|
||||||
nativeMouseMoveEventMsg()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// and return a function-wrapped promise to call afterwards to finish the drag
|
|
||||||
return function() {
|
|
||||||
return promiseNativeMouseEvent(
|
|
||||||
target,
|
|
||||||
mouseX + distanceX,
|
|
||||||
mouseY + distanceY,
|
|
||||||
nativeMouseUpEventMsg()
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Synthesizes a native touch sequence of events corresponding to a pinch-zoom-in
|
// Synthesizes a native touch sequence of events corresponding to a pinch-zoom-in
|
||||||
// at the given focus point.
|
// at the given focus point.
|
||||||
function* pinchZoomInTouchSequence(focusX, focusY) {
|
function* pinchZoomInTouchSequence(focusX, focusY) {
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0">
|
|
||||||
<title>Tests that pending visual scroll positions on RSFs of non-RCDs get cleared properly</title>
|
|
||||||
<script src="apz_test_utils.js"></script>
|
|
||||||
<script src="apz_test_native_event_utils.js"></script>
|
|
||||||
<script src="/tests/SimpleTest/paint_listener.js"></script>
|
|
||||||
<body>
|
|
||||||
<iframe style="width: 300px; height: 300px" id="scroller"></iframe>
|
|
||||||
<script>
|
|
||||||
function populateScroller() {
|
|
||||||
let text = '<div id="line0">line 0</div><br>';
|
|
||||||
for (let i = 1; i < 100; i++) {
|
|
||||||
text += 'line ' + i + '<br>';
|
|
||||||
}
|
|
||||||
/* eslint-disable no-unsanitized/property */
|
|
||||||
document.querySelector('#scroller').contentDocument.body.innerHTML = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function reconstructScroller() {
|
|
||||||
let scroller = document.querySelector('#scroller');
|
|
||||||
scroller.style.display = 'none';
|
|
||||||
/* eslint-disable no-unused-vars */
|
|
||||||
let dummyToForceFlush = scroller.scrollTop;
|
|
||||||
scroller.style.display = '';
|
|
||||||
dummyToForceFlush = scroller.scrollTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function test() {
|
|
||||||
let scroller = document.querySelector('#scroller');
|
|
||||||
let subwin = scroller.contentWindow;
|
|
||||||
|
|
||||||
populateScroller();
|
|
||||||
subwin.scrollTo(0, 100);
|
|
||||||
is(subwin.scrollY, 100, 'Scroller scrolled down to y=100');
|
|
||||||
|
|
||||||
// let the visual scroll position round-trip through APZ
|
|
||||||
await promiseApzFlushedRepaints();
|
|
||||||
|
|
||||||
// frame reconstruction does a ScrollToVisual. The bug is that the pending
|
|
||||||
// visual scroll offset update never gets cleared even though the paint
|
|
||||||
// transaction should clear it.
|
|
||||||
reconstructScroller();
|
|
||||||
await promiseApzFlushedRepaints();
|
|
||||||
|
|
||||||
// Scroll back up to the top using APZ-side scrolling, and wait for the APZ
|
|
||||||
// wheel animation to complete and the final scroll position to get synced
|
|
||||||
// back to the main thread.
|
|
||||||
await promiseMoveMouseAndScrollWheelOver(subwin, 10, 10, true, -100);
|
|
||||||
let utils = SpecialPowers.getDOMWindowUtils(window);
|
|
||||||
for (let i = 0; i < 60; i++) {
|
|
||||||
utils.advanceTimeAndRefresh(16);
|
|
||||||
}
|
|
||||||
utils.restoreNormalRefresh();
|
|
||||||
await promiseApzFlushedRepaints();
|
|
||||||
is(subwin.scrollY, 0, 'Scroller scrolled up to y=0');
|
|
||||||
|
|
||||||
// Do a mouse-drag-selection. I couldn't find any simpler way to reproduce
|
|
||||||
// the problem.
|
|
||||||
const kMouseMovePixels = 10;
|
|
||||||
let promiseMouseMovesDone = new Promise((resolve) => {
|
|
||||||
let mouseDownX = 0;
|
|
||||||
subwin.document.documentElement.addEventListener('mousedown', (e) => {
|
|
||||||
dump(`Got mousedown at ${e.screenX}\n`);
|
|
||||||
mouseDownX = e.screenX;
|
|
||||||
});
|
|
||||||
subwin.document.documentElement.addEventListener('mousemove', (e) => {
|
|
||||||
// Mousemove events can get squashed together so we check the coord
|
|
||||||
// instead.
|
|
||||||
dump(`Got mousemove at ${e.screenX}\n`);
|
|
||||||
if (e.screenX - mouseDownX >= kMouseMovePixels) {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
let line0 = subwin.document.querySelector('#line0');
|
|
||||||
let dragFinisher = await promiseNativeMouseDrag(line0, 1, 5, kMouseMovePixels, 0, kMouseMovePixels);
|
|
||||||
await promiseMouseMovesDone;
|
|
||||||
await dragFinisher();
|
|
||||||
|
|
||||||
is(subwin.scrollY, 0, 'Scroller should remain at y=0');
|
|
||||||
}
|
|
||||||
|
|
||||||
waitUntilApzStable()
|
|
||||||
.then(test)
|
|
||||||
.finally(subtestDone);
|
|
||||||
</script>
|
|
|
@ -39,9 +39,6 @@ var subtests = [
|
||||||
{"file": "helper_bug1490393-2.html"},
|
{"file": "helper_bug1490393-2.html"},
|
||||||
// Scrollbar-dragging on scrollframes inside filters inside transforms
|
// Scrollbar-dragging on scrollframes inside filters inside transforms
|
||||||
{"file": "helper_bug1550510.html"},
|
{"file": "helper_bug1550510.html"},
|
||||||
// Drag-select some text after reconstructing the RSF of a non-RCD to ensure
|
|
||||||
// the pending visual offset update doesn't get stuck
|
|
||||||
{"file": "helper_visualscroll_nonrcd_rsf.html"},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (isApzEnabled()) {
|
if (isApzEnabled()) {
|
||||||
|
|
|
@ -9296,9 +9296,7 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
|
||||||
presShell->ScrollToVisual(presShell->GetVisualViewportOffset(),
|
presShell->ScrollToVisual(presShell->GetVisualViewportOffset(),
|
||||||
FrameMetrics::eRestore, ScrollMode::Instant);
|
FrameMetrics::eRestore, ScrollMode::Instant);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (scrollableFrame->IsRootScrollFrameOfDocument()) {
|
|
||||||
if (const Maybe<PresShell::VisualScrollUpdate>& visualUpdate =
|
if (const Maybe<PresShell::VisualScrollUpdate>& visualUpdate =
|
||||||
presShell->GetPendingVisualScrollUpdate()) {
|
presShell->GetPendingVisualScrollUpdate()) {
|
||||||
metrics.SetVisualDestination(
|
metrics.SetVisualDestination(
|
||||||
|
@ -9306,9 +9304,6 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
|
||||||
metrics.SetVisualScrollUpdateType(visualUpdate->mUpdateType);
|
metrics.SetVisualScrollUpdateType(visualUpdate->mUpdateType);
|
||||||
presShell->AcknowledgePendingVisualScrollUpdate();
|
presShell->AcknowledgePendingVisualScrollUpdate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (aIsRootContent) {
|
|
||||||
// Expand the layout viewport to the size including the area covered by
|
// Expand the layout viewport to the size including the area covered by
|
||||||
// the dynamic toolbar in the case where the dynamic toolbar is being
|
// the dynamic toolbar in the case where the dynamic toolbar is being
|
||||||
// used, otherwise when the dynamic toolbar transitions on the compositor,
|
// used, otherwise when the dynamic toolbar transitions on the compositor,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче