Bug 1636911. Add mochitest. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D75665
This commit is contained in:
Timothy Nikkel 2020-05-18 10:26:28 +00:00
Родитель c910c877a9
Коммит c3fc615ca6
2 изменённых файлов: 187 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,170 @@
<!DOCTYPE HTML>
<html id="root-element">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Checkerboarding in while scrolling a subframe when root scrollframe has
overflow hidden and pinch zoomed in</title>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
function* test(testDriver) {
var utils = SpecialPowers.getDOMWindowUtils(window);
var initial_resolution = getResolution();
ok(initial_resolution > 0,
"The initial_resolution is " + initial_resolution + ", which is some sane value");
var subframe = document.getElementById('bugzilla-body');
// layerize subframe
yield synthesizeNativeClickAndWaitForClickEvent(subframe, 10, 10, testDriver);
// verify layerization
yield waitForAllPaints(() => setTimeout(testDriver, 0));
ok(isLayerized("bugzilla-body"), "subframe should be layerized at this point");
var subframeScrollId = utils.getViewId(subframe);
ok(subframeScrollId > 0, "subframe should have a scroll id");
// wait for the dust to settle
yield waitForAllPaints(() => setTimeout(testDriver, 0));
var waitForTouchEnd = function(e) {
dump("touchend listener hit\n");
setTimeout(testDriver, 0);
};
document.documentElement.addEventListener("touchend", waitForTouchEnd, {passive: true, once: false});
// Ensure that APZ gets updated hit-test info
yield waitForAllPaints(() => setTimeout(testDriver, 0));
var zoom_in = [
[ { x: 130, y: 280 }, { x: 150, y: 300 } ],
[ { x: 120, y: 250 }, { x: 160, y: 380 } ],
[ { x: 115, y: 200 }, { x: 180, y: 410 } ],
[ { x: 110, y: 150 }, { x: 200, y: 440 } ],
[ { x: 105, y: 120 }, { x: 210, y: 470 } ],
[ { x: 100, y: 100 }, { x: 230, y: 500 } ],
];
var touchIds = [0, 1];
yield* synthesizeNativeTouchSequences(document.body, zoom_in, null, touchIds);
yield; // wait for the touchend listener to fire
yield; // wait for the touchend listener to fire
document.documentElement.removeEventListener("touchend", waitForTouchEnd);
// Flush state and get the resolution we're at now
yield waitForApzFlushedRepaints(testDriver);
let final_resolution = getResolution();
ok(final_resolution > initial_resolution, "The final resolution (" + final_resolution + ") is greater than the initial resolution");
document.documentElement.addEventListener("touchend", waitForTouchEnd, {passive: true, once: true});
// pan back up to the top left
yield synthesizeNativeTouchDrag(window,
5,
5,
500,
500,
testDriver,
2);
yield; // wait for the touchend listener to fire
yield waitForApzFlushedRepaints(testDriver);
yield waitForAllPaints(() => setTimeout(testDriver, 0));
document.documentElement.addEventListener("touchend", waitForTouchEnd, {passive: true, once: true});
// pan right to expose the bug
yield synthesizeNativeTouchDrag(window,
100,
1,
-180,
0,
testDriver,
3);
yield; // wait for the touchend listener to fire
yield waitForApzFlushedRepaints(testDriver);
var data = utils.getCompositorAPZTestData();
//dump(JSON.stringify(data, null, 4));
var found = false;
for (apzcData of data.additionalData) {
if (apzcData.key == subframeScrollId) {
var checkerboarding = apzcData.value.split(',').includes("checkerboarding");
ok(!checkerboarding, "subframe is not checkerboarding");
found = true;
}
}
ok(found, "Found the checkerboarding subframe");
subtestDone();
}
waitUntilApzStable().then(runContinuation(test));
</script>
<style>
html,
body {
overflow-y: hidden;
height: 100%;
}
body {
position: absolute;
margin: 0;
width: 100%;
height: 100%;
}
#wrapper {
position: initial !important;
display: flex;
flex-direction: column;
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
}
#bugzilla-body {
flex: auto;
position: relative;
outline: none;
padding: 0 15px;
overflow-x: auto;
overflow-y: scroll;
will-change: transform;
}
</style>
</head>
<body>
<div id="wrapper">
<main id="bugzilla-body">
<p>STR:</p>
<ol>
<li>set <code>apz.allow_zoom</code> to <code>true</code></li>
<li>visit any bugzilla site (like this one)</li>
<li>zoom into the page and observe the left edge of the viewport</li>
</ol>
<p>ER: content should be shown<br>
AR: foreground content seems to disappear, looks like it's being cut off
</p>
<p>I attached a video of the STR to show the problem a little bit better. So far, I could only reproduce this on bugzilla. Words words words words words words words words words words words words words words words words words words words words words words.</p>
<div style="height: 10000px;"></div>
</main>
</div>
</body>
</html>

Просмотреть файл

@ -9,6 +9,7 @@
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
var prefs = [
["apz.test.logging_enabled", true],
["apz.paint_skipping.enabled", true],
@ -16,9 +17,24 @@
["general.smoothScroll", false],
["apz.minimap.enabled", true], // helps to debug these tests
];
const subtests = [
var zoom_and_pan_prefs = [
...prefs,
...getPrefs("TOUCH_EVENTS:PAN"),
["apz.allow_zooming", true],
];
var subtests = [
{ file: "helper_checkerboard_apzforcedisabled.html", prefs },
];
let isWindows = navigator.platform.indexOf("Win") == 0;
if (!isWindows) {
subtests.push(
{ file: "helper_checkerboard_zoomoverflowhidden.html", "prefs": zoom_and_pan_prefs }
);
}
// Run the actual test in its own window, because it requires that the
// root APZC be scrollable. Mochitest pages themselves often run
// inside an iframe which means we have no control over the root APZC.