Bug 1324591 - Add APZSampler::GetCompositionBounds to get the composition bounds for a given pair of LayersId and scrollId. r=botond

Depends on D75730

Differential Revision: https://phabricator.services.mozilla.com/D81481
This commit is contained in:
Hiroyuki Ikezoe 2020-07-05 11:43:45 +00:00
Родитель ec49c6a9a8
Коммит 80fc56a28e
2 изменённых файлов: 30 добавлений и 0 удалений

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

@ -98,6 +98,14 @@ class APZSampler {
void MarkAsyncTransformAppliedToContent(const LayerMetricsWrapper& aLayer);
bool HasUnusedAsyncTransform(const LayerMetricsWrapper& aLayer);
/**
* Returns the composition bounds of the APZC correspoinding to the pair of
* |aLayersId| and |aScrollId|.
*/
ParentLayerRect GetCompositionBounds(
const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId) const;
ScrollableLayerGuid GetGuid(const LayerMetricsWrapper& aLayer);
ScreenMargin GetGeckoFixedLayerMargins() const;

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

@ -212,6 +212,28 @@ ScreenMargin APZSampler::GetGeckoFixedLayerMargins() const {
return mApz->GetGeckoFixedLayerMargins();
}
ParentLayerRect APZSampler::GetCompositionBounds(
const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId) const {
// This function can get called on the compositor in case of non WebRender
// get called on the sampler thread in case of WebRender.
AssertOnSamplerThread();
RefPtr<AsyncPanZoomController> apzc =
mApz->GetTargetAPZC(aLayersId, aScrollId);
if (!apzc) {
// On WebRender it's possible that this function can get called even after
// the target APZC has been already destroyed because destroying the
// animation which triggers this function call is basically processed later
// than the APZC one, i.e. queue mCompositorAnimationsToDelete in
// WebRenderBridgeParent and then remove them in
// WebRenderBridgeParent::RemoveEpochDataPriorTo.
return ParentLayerRect();
}
return apzc->GetCompositionBounds();
}
void APZSampler::AssertOnSamplerThread() const {
if (APZThreadUtils::GetThreadAssertionsEnabled()) {
MOZ_ASSERT(IsSamplerThread());