Bug 1736497 - Assume config.isWebRender in APZ mochitests. r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D128836
This commit is contained in:
Botond Ballo 2021-10-19 17:15:08 +00:00
Родитель fd6e9db1c4
Коммит f8bdf8dd5d
13 изменённых файлов: 74 добавлений и 156 удалений

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

@ -775,14 +775,12 @@ async function injectScript(aScript, aWindow = window) {
// each time this function is called.
// The computed information is an object with three fields:
// utils: the nsIDOMWindowUtils instance for this window
// isWebRender: true if WebRender is enabled
// isWindow: true if the platform is Windows
// activateAllScrollFrames: true if prefs indicate all scroll frames are
// activated with at least a minimal display port
function getHitTestConfig() {
if (!("hitTestConfig" in window)) {
var utils = SpecialPowers.getDOMWindowUtils(window);
var isWebRender = utils.layerManagerType.startsWith("WebRender");
var isWindows = getPlatform() == "windows";
let activateAllScrollFrames =
SpecialPowers.getBoolPref("apz.wr.activate_all_scroll_frames") ||
@ -793,7 +791,6 @@ function getHitTestConfig() {
window.hitTestConfig = {
utils,
isWebRender,
isWindows,
activateAllScrollFrames,
};
@ -941,27 +938,15 @@ function hitTestScrollbar(params) {
// behaviour on different platforms which makes testing harder.
var expectedHitInfo = APZHitResultFlags.VISIBLE | APZHitResultFlags.SCROLLBAR;
if (params.expectThumb) {
// The thumb has listeners which are APZ-aware. With WebRender we are able
// to losslessly propagate this flag to APZ, but with non-WebRender the area
// ends up in the mDispatchToContentRegion which we then convert back to
// a IRREGULAR_AREA flag. This still works correctly since IRREGULAR_AREA
// will fall back to the main thread for everything.
if (config.isWebRender) {
expectedHitInfo |= APZHitResultFlags.APZ_AWARE_LISTENERS;
if (
!config.activateAllScrollFrames &&
params.layerState == LayerState.INACTIVE
) {
expectedHitInfo |= APZHitResultFlags.INACTIVE_SCROLLFRAME;
}
} else {
expectedHitInfo |= APZHitResultFlags.IRREGULAR_AREA;
// The thumb has listeners which are APZ-aware.
expectedHitInfo |= APZHitResultFlags.APZ_AWARE_LISTENERS;
var expectActive =
config.activateAllScrollFrames || params.layerState == LayerState.ACTIVE;
if (!expectActive) {
expectedHitInfo |= APZHitResultFlags.INACTIVE_SCROLLFRAME;
}
// We do not generate the layers for thumbs on inactive scrollframes.
if (
params.layerState == LayerState.ACTIVE ||
config.activateAllScrollFrames
) {
if (expectActive) {
expectedHitInfo |= APZHitResultFlags.SCROLLBAR_THUMB;
}
}

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

@ -22,9 +22,6 @@ add_task(async function test_main() {
);
}
var utils = SpecialPowers.getDOMWindowUtils(window);
var isWebRender = utils.layerManagerType.startsWith("WebRender");
// Each of these subtests is a dictionary that contains:
// file (required): filename of the subtest that will get opened in a new tab
// in the top-level fission-enabled browser window.
@ -64,26 +61,12 @@ add_task(async function test_main() {
{ file: "helper_fission_initial_displayport.html" },
{ file: "helper_fission_checkerboard_severity.html" },
{ file: "helper_fission_setResolution.html" },
{ file: "helper_fission_inactivescroller_positionedcontent.html" },
{ file: "helper_fission_irregular_areas.html" },
// Bug 1576514: On WebRender this test casues an assertion.
// { file: "helper_fission_animation_styling_in_transformed_oopif.html", },
// add additional tests here
];
// These tests are to ensure hit-testing works perfectly on the WR
// codepath. The layers codepath may need a main-thread fallback to get
// these working, but we can't use our synchronous hitTest(...) helpers
// for those anyway.
if (isWebRender) {
subtests = subtests.concat([
{ file: "helper_fission_inactivescroller_positionedcontent.html" },
{ file: "helper_fission_irregular_areas.html" },
// add WebRender-specific tests here
]);
} else {
subtests = subtests.concat([
// Bug 1576514: On WebRender this test casues an assertion.
{
file: "helper_fission_animation_styling_in_transformed_oopif.html",
},
]);
}
// ccov builds run slower and need longer, so let's scale up the timeout
// by the number of tests we're running.

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

@ -100,13 +100,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1689492
// but it gives a good idea that the good and bad values are far apart so
// this test should be robust, and provides good context in the future if
// this test starts failing.
await testOne( 50, 5.2, "(height 50)"); // good wr 256 non-wr 256, bad wr 256 non-wr 384
await testOne(128, 2.1, "(height128)"); // good wr 256 non-wr 256, bad wr 512 non-wr 640
await testOne(200, 2.0, "(height200)"); // good wr 384 non-wr 384, bad wr 768 non-wr 896
await testOne(256, 1.6, "(height256)"); // good wr 384 non-wr 384, bad wr 768 non-wr 1024
await testOne(329, 1.6, "(height329)"); // good wr 512 non-wr 512, bad wr 896 non-wr 1280
await testOne(500, 1.3, "(height500)"); // good wr 640 non-wr 640, bad wr 1280 non-wr 1920
await testOne(640, getHitTestConfig().isWebRender ? 1.7 : 1.3, "(height640)"); // good wr 1024 non-wr 768, bad wr 1536 non-wr 2432
await testOne( 50, 5.2, "(height 50)"); // good 256, bad 256
await testOne(128, 2.1, "(height128)"); // good 256, bad 512
await testOne(200, 2.0, "(height200)"); // good 384, bad 768
await testOne(256, 1.6, "(height256)"); // good 384, bad 768
await testOne(329, 1.6, "(height329)"); // good 512, bad 896
await testOne(500, 1.3, "(height500)"); // good 640, bad 280
await testOne(640, 1.7, "(height640)"); // good 1024, bad 1536
}

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

@ -25,12 +25,8 @@ async function test() {
var apzaware = document.getElementById("apzaware");
let expectedHitInfo = APZHitResultFlags.VISIBLE;
if (config.isWebRender) {
if (!config.activateAllScrollFrames) {
expectedHitInfo |= APZHitResultFlags.INACTIVE_SCROLLFRAME;
}
} else {
expectedHitInfo |= APZHitResultFlags.IRREGULAR_AREA;
if (!config.activateAllScrollFrames) {
expectedHitInfo |= APZHitResultFlags.INACTIVE_SCROLLFRAME;
}
checkHitResult(hitTest(centerOf(scroller)),
expectedHitInfo,
@ -66,13 +62,11 @@ async function test() {
await promiseApzFlushedRepaints();
var scrollY = scroller.scrollTopMax;
utils.setAsyncScrollOffset(scroller, 0, scrollY);
if (config.isWebRender) {
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for APZ hit-testing this doesn't matter, but for
// WebRender hit-testing we need to make sure WR has the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
}
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for WebRender hit-testing we need to make sure WR has
// the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
var scrollerViewId = utils.getViewId(scroller);
@ -88,8 +82,7 @@ async function test() {
apzawarePosition.y -= scrollY; // APZ position
checkHitResult(hitTest(apzawarePosition),
APZHitResultFlags.VISIBLE |
(config.isWebRender ? APZHitResultFlags.APZ_AWARE_LISTENERS
: APZHitResultFlags.IRREGULAR_AREA),
APZHitResultFlags.APZ_AWARE_LISTENERS,
scrollerViewId,
utils.getLayersId(),
"active scrollframe - apzaware block");

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

@ -31,13 +31,11 @@ async function test() {
await promiseApzFlushedRepaints();
var scrollY = scroller.scrollTopMax;
utils.setAsyncScrollOffset(scroller, 0, scrollY);
if (config.isWebRender) {
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for APZ hit-testing this doesn't matter, but for
// WebRender hit-testing we need to make sure WR has the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
}
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for WebRender hit-testing we need to make sure WR has
// the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
var scrollerViewId = utils.getViewId(scroller);

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

@ -35,8 +35,6 @@ async function test() {
var config = getHitTestConfig();
var utils = config.utils;
const wrTag = config.isWebRender ? "WebRender" : "Layers";
// layerize the iframe
var subwindow = document.getElementById("sub").contentWindow;
var subscroller = subwindow.document.scrollingElement;
@ -53,29 +51,27 @@ async function test() {
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (simple) uninteresting point inside the iframe`);
`(simple) uninteresting point inside the iframe`);
checkHitResult(hitTest({ x: 500, y: 10 }),
APZHitResultFlags.VISIBLE,
rootViewId,
layersId,
`${wrTag} (simple) uninteresting point in the root scroller`);
`(simple) uninteresting point in the root scroller`);
checkHitResult(hitTest({ x: 110, y: 110 }),
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (simple) point in the iframe behind overlaying div, but outside the bounding box of the clip path`);
`(simple) point in the iframe behind overlaying div, but outside the bounding box of the clip path`);
checkHitResult(hitTest({ x: 160, y: 160 }),
config.isWebRender ? APZHitResultFlags.VISIBLE
: APZHitResultFlags.VISIBLE | APZHitResultFlags.IRREGULAR_AREA,
config.isWebRender ? iframeViewId : rootViewId,
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (simple) point in the iframe behind overlaying div, inside the bounding box of the clip path, but outside the actual clip shape`);
`(simple) point in the iframe behind overlaying div, inside the bounding box of the clip path, but outside the actual clip shape`);
checkHitResult(hitTest({ x: 300, y: 200 }),
config.isWebRender ? APZHitResultFlags.VISIBLE
: APZHitResultFlags.VISIBLE | APZHitResultFlags.IRREGULAR_AREA,
APZHitResultFlags.VISIBLE,
rootViewId,
layersId,
`${wrTag} (simple) point inside the clip shape of the overlaying div`);
`(simple) point inside the clip shape of the overlaying div`);
// Now we turn the "simple" clip-path that WR can handle into a more complex
// one that needs a mask. Then run the checks again; the expected results for
@ -87,29 +83,27 @@ async function test() {
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (complex) uninteresting point inside the iframe`);
`(complex) uninteresting point inside the iframe`);
checkHitResult(hitTest({ x: 500, y: 10 }),
APZHitResultFlags.VISIBLE,
rootViewId,
layersId,
`${wrTag} (complex) uninteresting point in the root scroller`);
`(complex) uninteresting point in the root scroller`);
checkHitResult(hitTest({ x: 110, y: 110 }),
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (complex) point in the iframe behind overlaying div, but outside the bounding box of the clip path`);
`(complex) point in the iframe behind overlaying div, but outside the bounding box of the clip path`);
checkHitResult(hitTest({ x: 160, y: 160 }),
config.isWebRender ? APZHitResultFlags.VISIBLE
: APZHitResultFlags.VISIBLE | APZHitResultFlags.IRREGULAR_AREA,
config.isWebRender ? iframeViewId : rootViewId,
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (complex) point in the iframe behind overlaying div, inside the bounding box of the clip path, but outside the actual clip shape`);
`(complex) point in the iframe behind overlaying div, inside the bounding box of the clip path, but outside the actual clip shape`);
checkHitResult(hitTest({ x: 300, y: 200 }),
config.isWebRender ? APZHitResultFlags.VISIBLE
: APZHitResultFlags.VISIBLE | APZHitResultFlags.IRREGULAR_AREA,
config.isWebRender ? iframeViewId : rootViewId,
APZHitResultFlags.VISIBLE,
iframeViewId,
layersId,
`${wrTag} (complex) point inside the clip shape of the overlaying div`);
`(complex) point inside the clip shape of the overlaying div`);
}
waitUntilApzStable()

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

@ -64,11 +64,8 @@ async function test() {
utils.setDisplayPortForElement(0, 0, 300, 500, scroller, 1);
await promiseApzFlushedRepaints();
// Inactive scrollframe flags will round-trip through the dispatch-to-content
// region and end up as IRREGULAR_AREA when WebRender is disabled.
var expectedHitFlags = config.isWebRender
? APZHitResultFlags.VISIBLE | APZHitResultFlags.INACTIVE_SCROLLFRAME
: APZHitResultFlags.VISIBLE | APZHitResultFlags.IRREGULAR_AREA;
var expectedHitFlags =
APZHitResultFlags.VISIBLE | APZHitResultFlags.INACTIVE_SCROLLFRAME;
checkHitResult(hitTest(centerOf(scroller)),
expectedHitFlags,
utils.getViewId(scroller),

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

@ -41,9 +41,9 @@ async function test() {
var config = getHitTestConfig();
var utils = config.utils;
// Subframe hit testing of overscrolled APZCs does not yet work with WebRender,
// so bail out early.
if (config.isWebRender) {
// Subframe hit testing of overscrolled APZCs does not yet work with WebRender
// (bug 1701831), so bail out early.
if (true) {
SimpleTest.todo(false, "This test does not currently pass with WebRender");
return;
}

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

@ -120,12 +120,6 @@ async function test() {
var scrollId = config.utils.getViewId(document.scrollingElement);
var layersId = config.utils.getLayersId();
// Elements with APZ aware listeners round-trip through the dispatch-to-content
// region and end up as IRREGULAR_AREA when WebRender is disabled.
var touchListenerFlag = config.isWebRender
? APZHitResultFlags.APZ_AWARE_LISTENERS
: APZHitResultFlags.IRREGULAR_AREA;
checkHitResult(
hitTest(centerOf("taNone")),
APZHitResultFlags.VISIBLE |
@ -263,7 +257,7 @@ async function test() {
checkHitResult(
hitTest(centerOf("taInnerManipListener")),
APZHitResultFlags.VISIBLE |
touchListenerFlag |
APZHitResultFlags.APZ_AWARE_LISTENERS |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
scrollId,
layersId,
@ -272,14 +266,14 @@ async function test() {
checkHitResult(
hitTest(centerOf("taListener")),
APZHitResultFlags.VISIBLE |
touchListenerFlag,
APZHitResultFlags.APZ_AWARE_LISTENERS,
scrollId,
layersId,
"div with touch listener");
checkHitResult(
hitTest(centerOf("taInnerListenerPanX")),
APZHitResultFlags.VISIBLE |
touchListenerFlag |
APZHitResultFlags.APZ_AWARE_LISTENERS |
APZHitResultFlags.PAN_Y_DISABLED |
APZHitResultFlags.PINCH_ZOOM_DISABLED |
APZHitResultFlags.DOUBLE_TAP_ZOOM_DISABLED,
@ -351,14 +345,9 @@ async function test() {
"overflow:hidden div doesn't reset pan-x/pan-y from enclosing scroller");
}
if (!config.isWebRender) {
ok(true, "This test is WebRender-only because we get a bunch of dispatch-to-content regions without it and the test isn't very interesting.");
subtestDone();
} else {
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
</html>

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

@ -55,13 +55,11 @@ async function test() {
await promiseAllPaintsDone();
var scrollY = 300;
utils.setAsyncScrollOffset(subframe, 0, scrollY);
if (config.isWebRender) {
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for APZ hit-testing this doesn't matter, but for
// WebRender hit-testing we need to make sure WR has the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
}
// Tick the refresh driver once to make sure the compositor has applied the
// async scroll offset (for WebRender hit-testing we need to make sure WR has
// the latest info).
utils.advanceTimeAndRefresh(16);
utils.restoreNormalRefresh();
// Scroll over the subframe, and make sure that the page does not scroll,
// i.e. overscroll-behavior is respected.

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

@ -51,12 +51,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
let config = getHitTestConfig();
let heightMultiplier = SpecialPowers.getCharPref("apz.y_stationary_size_multiplier");
if (config.isWebRender) {
// With WebRender, the effective height multiplier can be reduced
// for alignment reasons. The reduction should be no more than a
// factor of two.
heightMultiplier /= 2;
}
// With WebRender, the effective height multiplier can be reduced
// for alignment reasons. The reduction should be no more than a
// factor of two.
heightMultiplier /= 2;
info("effective displayport height multipler is " + heightMultiplier);
let rootDisplayPort = getLastContentDisplayportFor('root-element');

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

@ -33,6 +33,7 @@ var overscroll_prefs = [...prefs,
];
var subtests = [
{"file": "helper_hittest_deep_scene_stack.html", "prefs": prefs},
{"file": "helper_hittest_pointerevents_svg.html", "prefs": prefs},
{"file": "helper_hittest_clippath.html", "prefs": prefs},
{"file": "helper_hittest_hoisted_scrollinfo.html", "prefs": prefs},
@ -47,26 +48,10 @@ var subtests = [
{"file": "helper_hittest_spam.html", "prefs": prefs},
];
function addConditionalTests(tests) {
// Add some more tests only useful with WebRender. Note that we do this in
// function run after loading, because trying to read layerManagerType can
// throw an NS_ERROR_FAILURE if called too early.
var utils = SpecialPowers.getDOMWindowUtils(window);
var isWebRender = utils.layerManagerType.startsWith("WebRender");
if (isWebRender) {
// Add new tests at the beginning, to ensure the final test remains in
// the final position.
tests = [
{"file": "helper_hittest_deep_scene_stack.html", "prefs": prefs},
].concat(tests);
}
return tests;
}
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
window.onload = function() {
runSubtestsSeriallyInFreshWindows(addConditionalTests(subtests))
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish, SimpleTest.finishWithFailure);
};
}

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

@ -64,12 +64,10 @@ let config = getHitTestConfig();
let activateAllScrollFrames = config.activateAllScrollFrames;
let heightMultiplier = SpecialPowers.getCharPref("apz.y_stationary_size_multiplier");
if (config.isWebRender) {
// With WebRender, the effective height multiplier can be reduced
// for alignment reasons. The reduction should be no more than a
// factor of two.
heightMultiplier /= 2;
}
// With WebRender, the effective height multiplier can be reduced
// for alignment reasons. The reduction should be no more than a
// factor of two.
heightMultiplier /= 2;
info("effective displayport height multipler is " + heightMultiplier);
function hasNonZeroMarginDisplayPort(elementId, containingDoc = null) {