summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/src/APZUpdater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz/src/APZUpdater.cpp')
-rw-r--r--gfx/layers/apz/src/APZUpdater.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/gfx/layers/apz/src/APZUpdater.cpp b/gfx/layers/apz/src/APZUpdater.cpp
index 2bbad6e1a7..2f1b551f3a 100644
--- a/gfx/layers/apz/src/APZUpdater.cpp
+++ b/gfx/layers/apz/src/APZUpdater.cpp
@@ -191,14 +191,38 @@ void APZUpdater::UpdateScrollDataAndTreeState(
auto isFirstPaint = aScrollData.IsFirstPaint();
auto paintSequenceNumber = aScrollData.GetPaintSequenceNumber();
+ auto previous = self->mScrollData.find(aOriginatingLayersId);
+ // If there's the previous scroll data which hasn't yet been
+ // processed, we need to merge the previous scroll position updates
+ // into the latest one.
+ if (previous != self->mScrollData.end()) {
+ WebRenderScrollData& previousData = previous->second;
+ if (previousData.GetWasUpdateSkipped()) {
+ MOZ_ASSERT(previousData.IsFirstPaint());
+ aScrollData.PrependUpdates(previousData);
+ }
+ }
+
self->mScrollData[aOriginatingLayersId] = std::move(aScrollData);
auto root = self->mScrollData.find(aRootLayerTreeId);
if (root == self->mScrollData.end()) {
return;
}
- self->mApz->UpdateHitTestingTree(
- WebRenderScrollDataWrapper(*self, &(root->second)),
- isFirstPaint, aOriginatingLayersId, paintSequenceNumber);
+ if ((self->mApz->UpdateHitTestingTree(
+ WebRenderScrollDataWrapper(*self, &(root->second)),
+ isFirstPaint, aOriginatingLayersId, paintSequenceNumber) ==
+ APZCTreeManager::OriginatingLayersIdUpdated::No) &&
+ isFirstPaint) {
+ // If the given |aOriginatingLayersId| data wasn't used for
+ // updating, it's likly that the parent process hasn't yet
+ // received the LayersId as "ReferentId", thus we need to process
+ // it in a subsequent update where we got the "ReferentId".
+ //
+ // NOTE: We restrict the above previous scroll data prepending to
+ // the first paint case, otherwise the cumulative scroll data may
+ // be exploded if we have never received the "ReferenceId".
+ self->mScrollData[aOriginatingLayersId].SetWasUpdateSkipped();
+ }
}));
}