Bug 1675547 - Update existing mochitests to handle WR layerizing. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D99985
This commit is contained in:
Kartikaya Gupta 2021-02-05 10:17:57 +00:00
Родитель f94f34ddc3
Коммит 0ea2998b72
6 изменённых файлов: 37 добавлений и 16 удалений

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

@ -844,7 +844,7 @@ var LayerState = {
// If directions.vertical is true, the vertical scrollbar will be tested.
// If directions.horizontal is true, the horizontal scrollbar will be tested.
// Both may be true in a single call (in which case two tests are performed).
// expectedScrollId: The scroll id that is expected to be hit.
// expectedScrollId: The scroll id that is expected to be hit, if WR is disabled.
// expectedLayersId: The layers id that is expected to be hit.
// trackLocation: One of ScrollbarTrackLocation.{START, END}.
// Determines which end of the scrollbar track is targeted.
@ -893,18 +893,27 @@ function hitTestScrollbar(params) {
// will fall back to the main thread for everything.
if (config.isWebRender) {
expectedHitInfo |= APZHitResultFlags.APZ_AWARE_LISTENERS;
if (params.layerState == LayerState.INACTIVE) {
expectedHitInfo |= APZHitResultFlags.INACTIVE_SCROLLFRAME;
}
} else {
expectedHitInfo |= APZHitResultFlags.IRREGULAR_AREA;
}
// We do not generate the layers for thumbs on inactive scrollframes.
if (params.layerState == LayerState.ACTIVE) {
if (params.layerState == LayerState.ACTIVE || config.isWebRender) {
expectedHitInfo |= APZHitResultFlags.SCROLLBAR_THUMB;
}
}
var expectedScrollId = params.expectedScrollId;
if (config.isWebRender) {
expectedScrollId = config.utils.getViewId(params.element);
if (params.layerState == LayerState.ACTIVE) {
is(
expectedScrollId,
params.expectedScrollId,
"Expected scrollId for active scrollframe should match"
);
}
}
var scrollframeMsg =
params.layerState == LayerState.ACTIVE
? "active scrollframe"
@ -926,7 +935,7 @@ function hitTestScrollbar(params) {
checkHitResult(
hitTest(verticalScrollbarPoint),
expectedHitInfo | APZHitResultFlags.SCROLLBAR_VERTICAL,
params.expectedScrollId,
expectedScrollId,
params.expectedLayersId,
scrollframeMsg + " - vertical scrollbar"
);
@ -946,7 +955,7 @@ function hitTestScrollbar(params) {
checkHitResult(
hitTest(horizontalScrollbarPoint),
expectedHitInfo,
params.expectedScrollId,
expectedScrollId,
params.expectedLayersId,
scrollframeMsg + " - horizontal scrollbar"
);

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

@ -51,8 +51,8 @@ async function test() {
// #scroller, but anywhere else within the OOPIF box should hit the OOPIF.
checkHitResult(await fissionHitTest(centerOf("abspos"), iframe),
APZHitResultFlags.VISIBLE | APZHitResultFlags.INACTIVE_SCROLLFRAME, // the INACTIVE_SCROLLFRAME flag may be dropped depending on how the fix is implemented
utils.getViewId(document.scrollingElement), // this may change to the scrollId of the inactive scrollframe depending on how the fix is implemented
APZHitResultFlags.VISIBLE,
utils.getViewId(document.getElementById("scroller")),
utils.getLayersId(),
"abspos element on top of OOPIF should hit parent doc hosting the OOPIF");

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

@ -26,9 +26,10 @@ async function test() {
checkHitResult(hitTest(centerOf(scroller)),
APZHitResultFlags.VISIBLE |
(config.isWebRender ? APZHitResultFlags.INACTIVE_SCROLLFRAME
(config.isWebRender ? 0
: APZHitResultFlags.IRREGULAR_AREA),
utils.getViewId(document.scrollingElement),
(config.isWebRender ? utils.getViewId(scroller)
: utils.getViewId(document.scrollingElement)),
utils.getLayersId(),
"inactive scrollframe");

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

@ -27,7 +27,8 @@
<script type="application/javascript">
function test(testDriver) {
var utils = getHitTestConfig().utils;
var config = getHitTestConfig();
var utils = config.utils;
let hasViewId;
try {
@ -36,7 +37,9 @@ function test(testDriver) {
} catch (e) {
hasViewId = false;
}
ok(!hasViewId, "The nested scroller should be inactive and not have a view id");
if (!config.isWebRender) {
ok(!hasViewId, "The nested scroller should be inactive and not have a view id");
}
checkHitResult(
hitTest(centerOf(document.body)),

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

@ -7,6 +7,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
<meta charset="utf-8">
<title>Test for Bug 1151663, helper page</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">
@ -46,10 +47,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
// The apzc tree for this page should consist of a single root APZC,
// which either is the RCD with no child APZCs (e10s/B2G case) or has a
// single child APZC which is for the RCD (fennec case).
// single child APZC which is for the RCD (fennec case). With WR enabled
// we activate scrollframes anyway, so we expect there to be a child.
var rcd = findRcdNode(apzcTree);
ok(rcd != null, "found the RCD node");
is(rcd.children.length, 0, "expected no children on the RCD");
if (getHitTestConfig().isWebRender) {
is(rcd.children.length, 1, "expected one child on the RCD");
} else {
is(rcd.children.length, 0, "expected no children on the RCD");
}
}
waitUntilApzStable()
.then(forceLayerTreeToCompositor)

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

@ -179,7 +179,9 @@ async function test() {
ok(isLayerized("outer4"), "outer4 is still layerized because inner4 is still layerized");
}
if (isApzEnabled()) {
if (getHitTestConfig().isWebRender) {
ok(true, "Skipping layerization test with WebRender because we layerize always now");
} else if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("we are testing code that measures an actual timeout");
SimpleTest.expectAssertions(0, 8); // we get a bunch of "ASSERTION: Bounds computation mismatch" sometimes (bug 1232856)