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

Differential Revision: https://phabricator.services.mozilla.com/D81481
This commit is contained in:
Hiroyuki Ikezoe 2020-07-05 02:19:45 +00:00
parent a32c79b20d
commit efee5d73c6
2 changed files with 30 additions and 0 deletions

View File

@ -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;

View File

@ -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());