зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1827975, bug 1831580) for causing mochitests failures in test_group_scrollend.html.
Backed out changeset 760e07b3a5ae (bug 1831580) Backed out changeset 87f29c301be9 (bug 1827975) Backed out changeset 8d034bde14e5 (bug 1827975)
This commit is contained in:
Родитель
1dbe12054b
Коммит
ce4fec6edc
|
@ -2109,12 +2109,6 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) {
|
|||
// exists
|
||||
if (mState != KEYBOARD_SCROLL) {
|
||||
CancelAnimation();
|
||||
// Keyboard input that does not change the scroll position should not
|
||||
// cause a TransformBegin state change, in order to avoid firing a
|
||||
// scrollend event when no scrolling occurred.
|
||||
if (ConvertDestinationToDelta(destination) == ParentLayerPoint()) {
|
||||
return nsEventStatus_eConsumeDoDefault;
|
||||
}
|
||||
SetState(KEYBOARD_SCROLL);
|
||||
|
||||
nsPoint initialPosition =
|
||||
|
@ -3945,20 +3939,6 @@ void AsyncPanZoomController::HandleSmoothScrollOverscroll(
|
|||
BuildOverscrollHandoffChain(), nullptr);
|
||||
}
|
||||
|
||||
ParentLayerPoint AsyncPanZoomController::ConvertDestinationToDelta(
|
||||
CSSPoint& aDestination) const {
|
||||
ParentLayerPoint startPoint, endPoint;
|
||||
|
||||
{
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
|
||||
startPoint = aDestination * Metrics().GetZoom();
|
||||
endPoint = Metrics().GetVisualScrollOffset() * Metrics().GetZoom();
|
||||
}
|
||||
|
||||
return endPoint - startPoint;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::SmoothScrollTo(
|
||||
CSSSnapDestination&& aDestination,
|
||||
ScrollTriggeredByScript aTriggeredByScript, const ScrollOrigin& aOrigin) {
|
||||
|
@ -3985,13 +3965,6 @@ void AsyncPanZoomController::SmoothScrollTo(
|
|||
}
|
||||
|
||||
CancelAnimation();
|
||||
|
||||
// If no scroll is required, we should exit early to avoid triggering
|
||||
// a scrollend event when no scrolling occurred.
|
||||
if (ConvertDestinationToDelta(aDestination.mPosition) == ParentLayerPoint()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetState(SMOOTH_SCROLL);
|
||||
nsPoint initialPosition =
|
||||
CSSPoint::ToAppUnits(Metrics().GetVisualScrollOffset());
|
||||
|
@ -4013,30 +3986,24 @@ void AsyncPanZoomController::SmoothMsdScrollTo(
|
|||
animation->SetDestination(aDestination.mPosition,
|
||||
std::move(aDestination.mTargetIds),
|
||||
aTriggeredByScript);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CancelAnimation();
|
||||
SetState(SMOOTHMSD_SCROLL);
|
||||
// Convert velocity from ParentLayerPoints/ms to ParentLayerPoints/s.
|
||||
CSSPoint initialVelocity;
|
||||
if (Metrics().GetZoom() != CSSToParentLayerScale(0)) {
|
||||
initialVelocity = ParentLayerPoint(mX.GetVelocity() * 1000.0f,
|
||||
mY.GetVelocity() * 1000.0f) /
|
||||
Metrics().GetZoom();
|
||||
}
|
||||
|
||||
// If no scroll is required, we should exit early to avoid triggering
|
||||
// a scrollend event when no scrolling occurred.
|
||||
if (ConvertDestinationToDelta(aDestination.mPosition) == ParentLayerPoint()) {
|
||||
return;
|
||||
StartAnimation(new SmoothMsdScrollAnimation(
|
||||
*this, Metrics().GetVisualScrollOffset(), initialVelocity,
|
||||
aDestination.mPosition,
|
||||
StaticPrefs::layout_css_scroll_behavior_spring_constant(),
|
||||
StaticPrefs::layout_css_scroll_behavior_damping_ratio(),
|
||||
std::move(aDestination.mTargetIds), aTriggeredByScript));
|
||||
}
|
||||
CancelAnimation();
|
||||
SetState(SMOOTHMSD_SCROLL);
|
||||
// Convert velocity from ParentLayerPoints/ms to ParentLayerPoints/s.
|
||||
CSSPoint initialVelocity;
|
||||
if (Metrics().GetZoom() != CSSToParentLayerScale(0)) {
|
||||
initialVelocity = ParentLayerPoint(mX.GetVelocity() * 1000.0f,
|
||||
mY.GetVelocity() * 1000.0f) /
|
||||
Metrics().GetZoom();
|
||||
}
|
||||
|
||||
StartAnimation(new SmoothMsdScrollAnimation(
|
||||
*this, Metrics().GetVisualScrollOffset(), initialVelocity,
|
||||
aDestination.mPosition,
|
||||
StaticPrefs::layout_css_scroll_behavior_spring_constant(),
|
||||
StaticPrefs::layout_css_scroll_behavior_damping_ratio(),
|
||||
std::move(aDestination.mTargetIds), aTriggeredByScript));
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::StartOverscrollAnimation(
|
||||
|
@ -5520,7 +5487,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
|||
aScrollMetadata.GetOverscrollBehavior());
|
||||
}
|
||||
|
||||
bool instantScrollMayTriggerTransform = false;
|
||||
bool scrollOffsetUpdated = false;
|
||||
bool smoothScrollRequested = false;
|
||||
bool didCancelAnimation = false;
|
||||
|
@ -5598,11 +5564,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
|||
MOZ_ASSERT(scrollUpdate.GetMode() == ScrollMode::Instant ||
|
||||
scrollUpdate.GetMode() == ScrollMode::Normal);
|
||||
|
||||
instantScrollMayTriggerTransform =
|
||||
scrollUpdate.GetMode() == ScrollMode::Instant &&
|
||||
scrollUpdate.GetScrollTriggeredByScript() ==
|
||||
ScrollTriggeredByScript::No;
|
||||
|
||||
// If the layout update is of a higher priority than the visual update, then
|
||||
// we don't want to apply the visual update.
|
||||
// If the layout update is of a clobbering type (or a smooth scroll request,
|
||||
|
@ -5735,15 +5696,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
|||
// Since the main-thread scroll offset changed we should trigger a
|
||||
// recomposite to make sure it becomes user-visible.
|
||||
ScheduleComposite();
|
||||
|
||||
// If the scroll offset was updated, we're not in a transforming state,
|
||||
// and we are scrolling by a non-zero delta, we should ensure
|
||||
// TransformBegin and TransformEnd notifications are sent.
|
||||
if (!IsTransformingState(mState) && instantScrollMayTriggerTransform &&
|
||||
cumulativeRelativeDelta && *cumulativeRelativeDelta != CSSPoint() &&
|
||||
!didCancelAnimation) {
|
||||
SendTransformBeginAndEnd();
|
||||
}
|
||||
} else if (needToReclampScroll) {
|
||||
// Even if we didn't accept a new scroll offset from content, the
|
||||
// scrollable rect or composition bounds may have changed in a way that
|
||||
|
@ -6275,14 +6227,6 @@ void AsyncPanZoomController::DispatchStateChangeNotification(
|
|||
}
|
||||
}
|
||||
}
|
||||
void AsyncPanZoomController::SendTransformBeginAndEnd() {
|
||||
RefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (controller) {
|
||||
controller->NotifyAPZStateChange(GetGuid(),
|
||||
APZStateChange::eTransformBegin);
|
||||
controller->NotifyAPZStateChange(GetGuid(), APZStateChange::eTransformEnd);
|
||||
}
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::IsInTransformingState() const {
|
||||
RecursiveMutexAutoLock lock(mRecursiveMutex);
|
||||
|
|
|
@ -1477,13 +1477,6 @@ class AsyncPanZoomController {
|
|||
*/
|
||||
void DispatchStateChangeNotification(PanZoomState aOldState,
|
||||
PanZoomState aNewState);
|
||||
|
||||
/**
|
||||
* Send a TransformBegin notification followed by a TransformEnd
|
||||
* notification.
|
||||
*/
|
||||
void SendTransformBeginAndEnd();
|
||||
|
||||
/**
|
||||
* Internal helpers for checking general state of this apzc.
|
||||
*/
|
||||
|
@ -1611,8 +1604,6 @@ class AsyncPanZoomController {
|
|||
ScrollTriggeredByScript aTriggeredByScript,
|
||||
const ScrollOrigin& aOrigin);
|
||||
|
||||
ParentLayerPoint ConvertDestinationToDelta(CSSPoint& aDestination) const;
|
||||
|
||||
// Start a smooth-scrolling animation to the given destination, with MSD
|
||||
// physics that is suited for scroll-snapping.
|
||||
void SmoothMsdScrollTo(CSSSnapDestination&& aDestination,
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="initial-scale=1,width=device-width">
|
||||
<script src="apz_test_utils.js"></script>
|
||||
<script src="apz_test_native_event_utils.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="/tests/SimpleTest/NativeKeyCodes.js"></script>
|
||||
<script src="/tests/SimpleTest/paint_listener.js"></script>
|
||||
<style>
|
||||
#scroller {
|
||||
height: 50vh;
|
||||
width: 50vw;
|
||||
overflow: scroll;
|
||||
overscroll-behavior: none;
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 200vh;
|
||||
width: 200vw;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="scroller">
|
||||
<div id="spacer">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
|
||||
async function test() {
|
||||
var scrollendCount = 0;
|
||||
|
||||
// Add a scrollend event listener that counts the number of scrollend
|
||||
// events fired to the scrollable element.
|
||||
scroller.addEventListener("scrollend", () => {
|
||||
scrollendCount += 1;
|
||||
});
|
||||
|
||||
// Move the mouse over the scroller and perform a mouse click.
|
||||
await promiseNativeMouseEventWithAPZ({
|
||||
target: scroller,
|
||||
offsetX: 10,
|
||||
offsetY: 10,
|
||||
type: "mousemove",
|
||||
});
|
||||
|
||||
await promiseNativeMouseEventWithAPZ({
|
||||
target: scroller,
|
||||
offsetX: 10,
|
||||
offsetY: 10,
|
||||
type: "mousedown",
|
||||
});
|
||||
|
||||
await promiseNativeMouseEventWithAPZ({
|
||||
target: scroller,
|
||||
offsetX: 10,
|
||||
offsetY: 10,
|
||||
type: "mouseup",
|
||||
});
|
||||
|
||||
// Determine the arrow key value based on the value of "direction".
|
||||
let key = null;
|
||||
let direction = searchParams.get("direction");
|
||||
switch (direction) {
|
||||
case "up":
|
||||
key = nativeArrowUpKey();
|
||||
break;
|
||||
case "down":
|
||||
key = nativeArrowDownKey();
|
||||
break;
|
||||
default:
|
||||
ok(false, "Unsupported direction value: " + direction);
|
||||
break;
|
||||
}
|
||||
|
||||
is(scrollendCount, 0, "A scrollend event should not be triggered yet");
|
||||
|
||||
// In order to exercise handling of keyboard events in APZ, we may
|
||||
// want to flush repaints before the key input.
|
||||
if (searchParams.has("flush-before-key")) {
|
||||
await promiseApzFlushedRepaints();
|
||||
}
|
||||
await promiseFrame();
|
||||
|
||||
let transformEndPromise = promiseTransformEnd();
|
||||
|
||||
await new Promise(resolve => {
|
||||
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, key, {},
|
||||
"", "", resolve);
|
||||
});
|
||||
|
||||
await promiseApzFlushedRepaints();
|
||||
|
||||
if (direction == "up") {
|
||||
if (SpecialPowers.getBoolPref("general.smoothScroll")) {
|
||||
// The smooth scroll animation with no distance should not be longer than
|
||||
// half a second.
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
} else {
|
||||
await promiseFrame();
|
||||
}
|
||||
is(scrollendCount, 0, "A user gesture with no scroll should have no scrollend");
|
||||
} else {
|
||||
if (SpecialPowers.getBoolPref("general.smoothScroll")) {
|
||||
// If smooth scrolling is enabled and there is room to scroll, wait for the
|
||||
// transform end notification.
|
||||
await transformEndPromise;
|
||||
}
|
||||
await promiseFrame();
|
||||
is(scrollendCount, 1, "A user gesture with a scroll should trigger a scrollend");
|
||||
}
|
||||
}
|
||||
waitUntilApzStable()
|
||||
.then(test)
|
||||
.then(subtestDone, subtestFailed);
|
||||
</script>
|
||||
</html>
|
|
@ -23,20 +23,8 @@ var prefs = [
|
|||
];
|
||||
|
||||
var smoothScrollDisabled = [
|
||||
...basePrefs,
|
||||
["general.smoothScroll", false],
|
||||
];
|
||||
|
||||
var smoothMsdScrollEnabled = [
|
||||
...basePrefs,
|
||||
["general.smoothScroll", true],
|
||||
["general.smoothScroll.msdPhysics.enabled", true],
|
||||
];
|
||||
|
||||
var smoothScrollEnabled = [
|
||||
...basePrefs,
|
||||
["general.smoothScroll", true],
|
||||
["general.smoothScroll.msdPhysics.enabled", false],
|
||||
];
|
||||
|
||||
var subtests = [
|
||||
|
@ -53,22 +41,6 @@ var subtests = [
|
|||
"prefs": smoothScrollDisabled},
|
||||
{"file": "helper_main_thread_smooth_scroll_scrollend.html",
|
||||
"prefs": smoothScrollDisabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=up",
|
||||
"prefs": smoothMsdScrollEnabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=up",
|
||||
"prefs": smoothScrollEnabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=up&flush-before-key",
|
||||
"prefs": smoothScrollEnabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=up",
|
||||
"prefs": smoothScrollDisabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=up&flush-before-key",
|
||||
"prefs": smoothScrollDisabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=down&flush-before-key",
|
||||
"prefs": smoothScrollEnabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=down&flush-before-key",
|
||||
"prefs": smoothScrollDisabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=down",
|
||||
"prefs": smoothScrollDisabled},
|
||||
];
|
||||
|
||||
if (isApzEnabled()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче