Backed out changeset 6df43bd2a7bc (bug 1724358) for causing gv-junit failures in testOverscrollBehaviorNoneAuto

This commit is contained in:
Alexandru Michis 2021-08-22 03:15:08 +03:00
Родитель 8f7a2ef029
Коммит 27cbe35110
5 изменённых файлов: 10 добавлений и 136 удалений

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

@ -2181,16 +2181,10 @@ bool AsyncPanZoomController::CanScroll(const InputData& aEvent) const {
ScrollDirections AsyncPanZoomController::GetAllowedHandoffDirections() const {
ScrollDirections result;
RecursiveMutexAutoLock lock(mRecursiveMutex);
// In Fission there can be non-scrollable APZCs. It's unclear whether
// overscroll-behavior should be respected for these
// (see https://github.com/w3c/csswg-drafts/issues/6523) but
// we currently don't, to match existing practice.
const bool isScrollable = mX.CanScroll() || mY.CanScroll();
if (!isScrollable || mX.OverscrollBehaviorAllowsHandoff()) {
if (mX.OverscrollBehaviorAllowsHandoff()) {
result += ScrollDirection::eHorizontal;
}
if (!isScrollable || mY.OverscrollBehaviorAllowsHandoff()) {
if (mY.OverscrollBehaviorAllowsHandoff()) {
result += ScrollDirection::eVertical;
}
return result;
@ -3659,14 +3653,13 @@ Maybe<CSSPoint> AsyncPanZoomController::GetCurrentAnimationDestination(
ParentLayerPoint
AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehavior(
ParentLayerPoint& aHandoffVelocity) const {
RecursiveMutexAutoLock lock(mRecursiveMutex);
ParentLayerPoint residualVelocity;
ScrollDirections handoffDirections = GetAllowedHandoffDirections();
if (!handoffDirections.contains(ScrollDirection::eHorizontal)) {
if (!mX.OverscrollBehaviorAllowsHandoff()) {
residualVelocity.x = aHandoffVelocity.x;
aHandoffVelocity.x = 0;
}
if (!handoffDirections.contains(ScrollDirection::eVertical)) {
if (!mY.OverscrollBehaviorAllowsHandoff()) {
residualVelocity.y = aHandoffVelocity.y;
aHandoffVelocity.y = 0;
}
@ -3674,8 +3667,9 @@ AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehavior(
}
bool AsyncPanZoomController::OverscrollBehaviorAllowsSwipe() const {
RecursiveMutexAutoLock lock(mRecursiveMutex);
// Swipe navigation is a "non-local" overscroll behavior like handoff.
return GetAllowedHandoffDirections().contains(ScrollDirection::eHorizontal);
return mX.OverscrollBehaviorAllowsHandoff();
}
void AsyncPanZoomController::HandleFlingOverscroll(
@ -3799,11 +3793,11 @@ bool AsyncPanZoomController::CallDispatchScroll(
// Obey overscroll-behavior.
ParentLayerPoint endPoint = aEndPoint;
if (aOverscrollHandoffState.mChainIndex > 0) {
ScrollDirections handoffDirections = GetAllowedHandoffDirections();
if (!handoffDirections.contains(ScrollDirection::eHorizontal)) {
RecursiveMutexAutoLock lock(mRecursiveMutex);
if (!mX.OverscrollBehaviorAllowsHandoff()) {
endPoint.x = aStartPoint.x;
}
if (!handoffDirections.contains(ScrollDirection::eVertical)) {
if (!mY.OverscrollBehaviorAllowsHandoff()) {
endPoint.y = aStartPoint.y;
}
if (aStartPoint == endPoint) {

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

@ -368,8 +368,6 @@ class Axis {
const FrameMetrics& GetFrameMetrics() const;
const ScrollMetadata& GetScrollMetadata() const;
// Do not use this function directly, use
// AsyncPanZoomController::GetAllowedHandoffDirections instead.
virtual OverscrollBehavior GetOverscrollBehavior() const = 0;
// Adjust a requested overscroll amount for resistance, yielding a smaller

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

@ -1,4 +0,0 @@
<!DOCTYPE html>
<script src="apz_test_utils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>

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

@ -1,113 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>scroll handoff on non scrollable iframe document with overscroll-behavior: none</title>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script src="apz_test_utils.js"></script>
<script src="apz_test_native_event_utils.js"></script>
</head>
<style>
iframe {
width: 500px;
height: 500px;
}
</style>
<body>
<iframe></iframe>
<div style="height:1000vh"></div>
<script>
// This test runs twice, with a same origin iframe first then with a cross
// origin iframe second.
async function test(targetOrigin) {
const iframe = document.querySelector("iframe");
const targetURL =
SimpleTest.getTestFileURL("helper_empty.html")
.replace(window.location.origin, targetOrigin);
iframe.src = targetURL;
await new Promise(resolve => {
iframe.onload = resolve;
});
await SpecialPowers.spawn(iframe, [], async () => {
content.document.documentElement.style =
"overscroll-behavior-y: none; overflow-y: scroll;";
// Flush the style change.
content.document.documentElement.getBoundingClientRect();
// Make sure the style change reaches to APZ.
await content.window.wrappedJSObject.promiseApzFlushedRepaints();
});
let scrollEventPromise = new Promise(resolve => {
window.addEventListener("scroll", resolve, { once: true });
});
synthesizeNativeWheel(iframe, 100, 100, 0, -10);
await scrollEventPromise;
await waitToClearOutAnyPotentialScrolls(window);
ok(window.scrollY > 0,
"Mouse wheel scrolling on an OOP iframe where the iframe document is " +
"not scrollable but has overscroll-behavior: none property should be " +
"handed off to the parent");
// Make sure the wheel scrolling has finished.
await waitToClearOutAnyPotentialScrolls(window);
// Make the iframe document scrollable and try to scroll up on the iframe
// document.
await SpecialPowers.spawn(iframe, [], async () => {
content.document.body.style = "height: 500vh;";
// Flush the style change.
content.document.documentElement.getBoundingClientRect();
// Make sure the style change reaches to APZ.
await content.window.wrappedJSObject.promiseApzFlushedRepaints();
});
const mousemoveEventPromise = SpecialPowers.spawn(iframe, [], async () => {
await new Promise(resolve => {
content.window.addEventListener("mousemove", resolve, { once: true });
});
});
// Make sure the above event listener is registered.
await SpecialPowers.spawn(iframe, [], async () => {
await content.window.wrappedJSObject.promiseApzFlushedRepaints();
});
const scrollPos = window.scrollY;
// Send a mousemove event on the iframe to finish the last wheel event block.
synthesizeNativeMouseEventWithAPZ({
type: "mousemove",
target: iframe,
offsetX: 100,
offsetY: 100 + scrollPos,
});
await mousemoveEventPromise;
// Try to scroll up by a new wheel event on the iframe.
synthesizeNativeWheel(iframe, 100, 100 + scrollPos, 0, 10);
await waitToClearOutAnyPotentialScrolls(window);
// The wheel event should not be handed off to the root scroller since the
// iframe document has `overscroll-behavior-y: none`.
is(window.scrollY, scrollPos,
"The root scroller's position should never be changed");
// Restore the root scroll position for the next test case.
window.scrollTo(0, 0);
}
waitUntilApzStable()
.then(async () => test(window.location.origin))
.then(async () => test("http://example.com/"))
.then(subtestDone, subtestFailed);
</script>
</body>
</html>

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

@ -43,7 +43,6 @@ var subtests = [
{"file": "helper_scroll_over_scrollbar.html", "prefs": scrollbar_prefs},
{"file": "helper_scroll_tables_perspective.html", "prefs": prefs},
{"file": "helper_wheelevents_handoff_on_iframe.html", "prefs": prefs},
{"file": "helper_wheelevents_handoff_on_non_scrollable_iframe.html", "prefs": prefs},
];
// Only Windows has the test api implemented for this test.