зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1762875. Don't let swipe to navigation ui element fade animation get cut off. r=hiro
There are two completely separately mechanisms that fade the UI element, one drives the fade out if a navigation was successful, one drives the animation if navigation did not happen. If navigation is successful the animation is handled by browser/base/content/browser-gestureSupport.js. If navigation is not succesful the animation is handled by widget/SwipeTracker.cpp. I'm not sure why it was done that way. If navigation is unsuccessful the opacity gets updated the same way as during the gesture: by sending eSwipeGestureUpdate events and putting the opacity amount on the event. If navigation is successfull we send the eSwipeGesture event. This causes us to call gHistorySwipeAnimation.stopAnimation() at https://searchfox.org/mozilla-central/rev/26a1b0fce12e6dd495a954c542bb1e7bd6e0d548/browser/base/content/browser-gestureSupport.js#449 which https://searchfox.org/mozilla-central/rev/26a1b0fce12e6dd495a954c542bb1e7bd6e0d548/browser/base/content/browser-gestureSupport.js#706 sets this._isStoppingAnimation = true and sets a transition on the element and then sets the opacity to 0. The _isStoppingAnimation part makes us ignore anymore incoming swipe gesture updates that SwipeTracker.cpp is sending, and then after the transition is finished is removes the boxes so isAnimationRunning() returns false which blocks the swipe gesture updates from having any effect after the transition. However, when the SwipeTracker.cpp animation finishes it sends a eSwipeGestureEnd which browser-gestureSupport.js does not ignore. So don't start the SwipeTracker animation in the case where we don't need it. Differential Revision: https://phabricator.services.mozilla.com/D142820
This commit is contained in:
Родитель
b3a10a6967
Коммит
ac0f7cfb2d
|
@ -128,14 +128,13 @@ nsEventStatus SwipeTracker::ProcessEvent(const PanGestureInput& aEvent) {
|
|||
mLastEventTimeStamp = aEvent.mTimeStamp;
|
||||
} else {
|
||||
mEventsAreControllingSwipe = false;
|
||||
double targetValue = 0.0;
|
||||
if (ComputeSwipeSuccess()) {
|
||||
// Let's use same timestamp as previous event because this is caused by
|
||||
// the preceding event.
|
||||
SendSwipeEvent(eSwipeGesture, mSwipeDirection, 0.0, aEvent.mTimeStamp);
|
||||
targetValue = SwipeSuccessTargetValue();
|
||||
} else {
|
||||
StartAnimating(0.0);
|
||||
}
|
||||
StartAnimating(targetValue);
|
||||
}
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
|
Загрузка…
Ссылка в новой задаче