Bug 1664626 - Move one of the conditions for ignoring a visual scroll update. r=botond

This should be equivalent but a little easier to reason about.

Differential Revision: https://phabricator.services.mozilla.com/D90721
This commit is contained in:
Kartikaya Gupta 2020-09-18 21:10:45 +00:00
Родитель ca2055baa0
Коммит 51515fcb71
1 изменённых файлов: 14 добавлений и 9 удалений

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

@ -4514,18 +4514,9 @@ void AsyncPanZoomController::NotifyLayersUpdated(
// particular location. This is different from a layout viewport offset update
// in that the layout viewport offset is limited to the layout scroll range,
// while the visual viewport offset is not.
// The update type indicates the priority; an eMainThread layout update (or
// a smooth scroll request which is similar) takes precedence over an eRestore
// visual update, but we allow the possibility for the main thread to ask us
// to scroll both the layout and visual viewports to distinct (but compatible)
// locations (via e.g. both updates being eRestore).
bool visualScrollOffsetUpdated =
isDefault ||
aLayerMetrics.GetVisualScrollUpdateType() != FrameMetrics::eNone;
if (aLayerMetrics.GetScrollUpdateType() == FrameMetrics::eMainThread &&
aLayerMetrics.GetVisualScrollUpdateType() != FrameMetrics::eMainThread) {
visualScrollOffsetUpdated = false;
}
// TODO if we're in a drag and scrollOffsetUpdated is set then we want to
// ignore it
@ -4727,6 +4718,20 @@ void AsyncPanZoomController::NotifyLayersUpdated(
MOZ_ASSERT(scrollUpdate.GetMode() == ScrollMode::Instant ||
scrollUpdate.GetMode() == ScrollMode::Normal);
// 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,
// which is handled above) then it takes precedence over an eRestore visual
// update. But we also allow the possibility for the main thread to ask us
// to scroll both the layout and visual viewports to distinct (but
// compatible) locations (via e.g. both updates being of a non-clobbering/
// eRestore type).
if (nsLayoutUtils::CanScrollOriginClobberApz(scrollUpdate.GetOrigin()) &&
aLayerMetrics.GetVisualScrollUpdateType() !=
FrameMetrics::eMainThread) {
visualScrollOffsetUpdated = false;
}
Maybe<CSSPoint> relativeDelta;
if (StaticPrefs::apz_relative_update_enabled() &&