mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1705622. Add test. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D112352
This commit is contained in:
parent
a3e7cf4e01
commit
3ba349dc36
@ -0,0 +1,88 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=2100"/>
|
||||
<title>Check that double tapping active scrollable elements in fixed pos work</title>
|
||||
<script src="apz_test_native_event_utils.js"></script>
|
||||
<script src="apz_test_utils.js"></script>
|
||||
<script src="/tests/SimpleTest/paint_listener.js"></script>
|
||||
<script>
|
||||
|
||||
async function makeActive(x, y, targetId) {
|
||||
let theTarget = document.getElementById(targetId);
|
||||
await promiseNativeMouseEventWithAPZAndWaitForEvent({
|
||||
type: "click",
|
||||
target: theTarget,
|
||||
offsetX: x,
|
||||
offsetY: y,
|
||||
});
|
||||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
ok(isLayerized(targetId), "target should be layerized at this point");
|
||||
let utils = SpecialPowers.getDOMWindowUtils(window);
|
||||
let targetScrollId = utils.getViewId(theTarget);
|
||||
ok(targetScrollId > 0, "target should have a scroll id");
|
||||
}
|
||||
|
||||
async function test() {
|
||||
let useTouchpad = (location.search == "?touchpad");
|
||||
|
||||
let resolution = getResolution();
|
||||
ok(resolution > 0,
|
||||
"The initial_resolution is " + resolution + ", which is some sane value");
|
||||
|
||||
await makeActive(100, 50, "target");
|
||||
|
||||
let target = document.getElementById("target");
|
||||
|
||||
// Check that double-tapping once zooms in
|
||||
await doubleTapOn(target, 100, 50, useTouchpad);
|
||||
let prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);
|
||||
|
||||
// Check that double-tapping again on the same spot zooms out
|
||||
await doubleTapOn(target, 100, 50, useTouchpad);
|
||||
prev_resolution = resolution;
|
||||
resolution = getResolution();
|
||||
ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
|
||||
}
|
||||
|
||||
waitUntilApzStable()
|
||||
.then(test)
|
||||
.then(subtestDone, subtestFailed);
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.fixed {
|
||||
top: 100px;
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
background: blue;
|
||||
position: fixed;
|
||||
}
|
||||
.abox {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
background: yellow;
|
||||
overflow: auto;
|
||||
}
|
||||
.spacer {
|
||||
height: 400vh;
|
||||
background: lightgrey;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="fixed">
|
||||
<div class="abox" id="target">
|
||||
<div class="spacer" style="width: 50px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="spacer" style="width: 100px;"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -22,6 +22,11 @@ var visualviewport_and_doubletap_prefs = [
|
||||
["dom.visualviewport.enabled", true],
|
||||
];
|
||||
|
||||
var logging_and_doubletap_prefs = [
|
||||
...doubletap_prefs,
|
||||
["apz.test.logging_enabled", true],
|
||||
];
|
||||
|
||||
var subtests = [
|
||||
{"file": "helper_doubletap_zoom.html", "prefs": doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_img.html", "prefs": doubletap_prefs},
|
||||
@ -29,6 +34,7 @@ var subtests = [
|
||||
{"file": "helper_doubletap_zoom_horizontal_center.html", "prefs": visualviewport_and_doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_bug1702464.html", "prefs": visualviewport_and_doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_large_overflow.html", "prefs": doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_fixedpos.html", "prefs": logging_and_doubletap_prefs},
|
||||
];
|
||||
|
||||
if (getPlatform() == "mac") {
|
||||
@ -42,7 +48,8 @@ if (getPlatform() == "mac") {
|
||||
{"file": "helper_doubletap_zoom_bug1702464.html?touchpad", "prefs": visualviewport_and_doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_htmlelement.html", "prefs": doubletap_prefs}, // scrollbars don't receive events or take space on android
|
||||
{"file": "helper_doubletap_zoom_htmlelement.html?touchpad", "prefs": doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_large_overflow.html?touchpad", "prefs": doubletap_prefs}
|
||||
{"file": "helper_doubletap_zoom_large_overflow.html?touchpad", "prefs": doubletap_prefs},
|
||||
{"file": "helper_doubletap_zoom_fixedpos.html?touchpad", "prefs": logging_and_doubletap_prefs},
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user