зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1831580 - Post a Transform notification for instant scrolls. r=hiro
Keyboard scrolls and any other non-script driven instant scrolls handled by APZ, should post TransformBegin and TransformEnd notifications. Depends on D187051 Differential Revision: https://phabricator.services.mozilla.com/D188519
This commit is contained in:
Родитель
52f0c1fd2a
Коммит
1dbe12054b
|
@ -5520,6 +5520,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
|||
aScrollMetadata.GetOverscrollBehavior());
|
||||
}
|
||||
|
||||
bool instantScrollMayTriggerTransform = false;
|
||||
bool scrollOffsetUpdated = false;
|
||||
bool smoothScrollRequested = false;
|
||||
bool didCancelAnimation = false;
|
||||
|
@ -5597,6 +5598,11 @@ 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,
|
||||
|
@ -5729,6 +5735,15 @@ 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
|
||||
|
@ -6260,6 +6275,14 @@ 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,6 +1477,13 @@ 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.
|
||||
*/
|
||||
|
|
|
@ -67,9 +67,8 @@ var subtests = [
|
|||
"prefs": smoothScrollEnabled},
|
||||
{"file": "helper_keyboard_scrollend.html?direction=down&flush-before-key",
|
||||
"prefs": smoothScrollDisabled},
|
||||
// FIXME(dlrobertson): When bug 1831580 is fixed, add additional tests
|
||||
// for scrollend events following keyboard scrolls that do change the
|
||||
// scroll position without being handled by a APZC on-keyboard scroll.
|
||||
{"file": "helper_keyboard_scrollend.html?direction=down",
|
||||
"prefs": smoothScrollDisabled},
|
||||
];
|
||||
|
||||
if (isApzEnabled()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче