Bug 1496843. Make sure we update mRect when mImageBounds changes. r=mattwoodrow

This makes sure we don't end up with stale entries with geometry clipped
to the previous mImageBounds on the receiving side.

The update code is duplicated for now but will hopefully be cleaned up
after the blob re-coordination work is done.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Muizelaar 2018-11-11 22:49:38 +00:00
Родитель 36515cbbba
Коммит 8aa00debf2
1 изменённых файлов: 27 добавлений и 0 удалений

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

@ -549,18 +549,45 @@ struct DIGroup
aData->mRect = transformedRect.Intersect(mImageBounds);
InvalidateRect(aData->mRect);
GP("UpdateContainerLayerPropertiesAndDetectChange change\n");
} else if (!aData->mImageRect.IsEqualEdges(mImageBounds)) {
// Make sure we update mRect for mImageBounds changes
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
// The invalid rect should contain the old rect and the new rect
// because the parent should have invalidated this area
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
aData->mRect = transformedRect.Intersect(mImageBounds);
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
GP("ContainerLayer image rect bounds change\n");
} else {
// XXX: this code can eventually be deleted/made debug only
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
auto rect = transformedRect.Intersect(mImageBounds);
GP("Layer NoChange: %s %d %d %d %d\n", aItem->Name(),
aData->mRect.x, aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
MOZ_RELEASE_ASSERT(rect.IsEqualEdges(aData->mRect));
}
} else if (!aData->mImageRect.IsEqualEdges(mImageBounds)) {
// Make sure we update mRect for mImageBounds changes
UniquePtr<nsDisplayItemGeometry> geometry(aItem->AllocateGeometry(aBuilder));
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
// The invalid rect should contain the old rect and the new rect
// because the parent should have invalidated this area
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
aData->mRect = transformedRect.Intersect(mImageBounds);
MOZ_RELEASE_ASSERT(mInvalidRect.Contains(aData->mRect));
GP("image rect bounds change\n");
} else {
// XXX: this code can eventually be deleted/made debug only
UniquePtr<nsDisplayItemGeometry> geometry(aItem->AllocateGeometry(aBuilder));
combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
IntRect transformedRect = ToDeviceSpace(combined.GetBounds(), aMatrix, appUnitsPerDevPixel, mLayerBounds.TopLeft());
auto rect = transformedRect.Intersect(mImageBounds);
GP("NoChange: %s %d %d %d %d\n", aItem->Name(),
aData->mRect.x, aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
MOZ_RELEASE_ASSERT(rect.IsEqualEdges(aData->mRect));
}
}
}