Bug 1611660 - Accept layout viewport updates from the main thread right away. r=tnikkel

Previously, we would wait until the following frame (for uncertain reasons
that date back to B2G), but this meant the layout and visual viewports would
be out of sync for a frame, causing APZ to misbehave.

Differential Revision: https://phabricator.services.mozilla.com/D61286

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2020-01-30 10:48:34 +00:00
Родитель 334c8053ca
Коммит f62b4f716b
1 изменённых файлов: 7 добавлений и 22 удалений

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

@ -4548,28 +4548,13 @@ void AsyncPanZoomController::NotifyLayersUpdated(
RepaintUpdateType contentRepaintType = RepaintUpdateType::eNone; RepaintUpdateType contentRepaintType = RepaintUpdateType::eNone;
bool viewportUpdated = false; bool viewportUpdated = false;
// We usually don't entertain viewport updates on the same transaction as if (Metrics().GetLayoutViewport().Size() !=
// a composition bounds update, but we make an exception for Android aLayerMetrics.GetLayoutViewport().Size()) {
// to avoid the composition bounds and the viewport diverging during needContentRepaint = true;
// orientation changes and dynamic toolbar transitions. viewportUpdated = true;
// TODO: Do this on all platforms. }
bool entertainViewportUpdates = if (viewportUpdated || scrollOffsetUpdated) {
FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Width(), Metrics().SetLayoutViewport(aLayerMetrics.GetLayoutViewport());
Metrics().GetCompositionBounds().Width()) &&
FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Height(),
Metrics().GetCompositionBounds().Height());
#if defined(MOZ_WIDGET_ANDROID)
entertainViewportUpdates = true;
#endif
if (entertainViewportUpdates) {
if (Metrics().GetLayoutViewport().Size() !=
aLayerMetrics.GetLayoutViewport().Size()) {
needContentRepaint = true;
viewportUpdated = true;
}
if (viewportUpdated || scrollOffsetUpdated) {
Metrics().SetLayoutViewport(aLayerMetrics.GetLayoutViewport());
}
} }
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)