Bug 1738926 Part 1: Check if sublayers need to be rebuilt. r=mstange

This fixes a correctness issue. Since NativeLayerCA Representations can
generate new CALayers under certain conditions, the NativeLayerRootCA must
check to see if a rebuild is necessary when committing.

Differential Revision: https://phabricator.services.mozilla.com/D131307
This commit is contained in:
Brad Werth 2021-11-18 21:28:44 +00:00
Родитель 136d8c49e7
Коммит 5ad125fce1
2 изменённых файлов: 7 добавлений и 0 удалений

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

@ -276,6 +276,7 @@ class NativeLayerCA : public NativeLayer {
CALayer* UnderlyingCALayer(WhichRepresentation aRepresentation);
void ApplyChanges(WhichRepresentation aRepresentation);
bool HasUpdate(WhichRepresentation aRepresentation);
bool HasUpdateAffectingLayers(WhichRepresentation aRepresentation);
void SetBackingScale(float aBackingScale);
// Invalidates the specified region in all surfaces that are tracked by this

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

@ -335,6 +335,7 @@ void NativeLayerRootCA::Representation::Commit(WhichRepresentation aRepresentati
// list of sublayers. The order is important because we need layer->UnderlyingCALayer()
// to be non-null, and the underlying CALayer gets lazily initialized in ApplyChanges().
for (auto layer : aSublayers) {
mustRebuild |= layer->HasUpdateAffectingLayers(aRepresentation);
layer->ApplyChanges(aRepresentation);
}
@ -1194,6 +1195,11 @@ bool NativeLayerCA::HasUpdate(WhichRepresentation aRepresentation) {
return GetRepresentation(aRepresentation).HasUpdate();
}
bool NativeLayerCA::HasUpdateAffectingLayers(WhichRepresentation aRepresentation) {
MutexAutoLock lock(mMutex);
return GetRepresentation(aRepresentation).mMutatedSpecializeVideo;
}
CALayer* NativeLayerCA::UnderlyingCALayer(WhichRepresentation aRepresentation) {
MutexAutoLock lock(mMutex);
return GetRepresentation(aRepresentation).UnderlyingCALayer();