Bug 1267438 - Support adding ancestor mask layers from places other than SetupScrollingMetadata. r=mstange

MozReview-Commit-ID: DwdbSRdEMEc

--HG--
extra : rebase_source : 703ff74d56cecf0546457ff8940265f97a3331cc
extra : source : 1c8e4840f8b40b7e02b9274e446e278e8c907053
extra : histedit_source : 6efd4834b4ec52a6d57a05bdd9529cf39a7669a4
This commit is contained in:
Botond Ballo 2016-05-06 19:34:16 -04:00
Родитель 241127e62f
Коммит de687339fd
2 изменённых файлов: 20 добавлений и 3 удалений

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

@ -1088,7 +1088,7 @@ public:
/**
* CONSTRUCTION PHASE ONLY
* Add a FrameMetrics-associated mask layer.
* Add mask layers associated with LayerClips.
*/
void SetAncestorMaskLayers(const nsTArray<RefPtr<Layer>>& aLayers) {
if (aLayers != mAncestorMaskLayers) {
@ -1098,6 +1098,15 @@ public:
}
}
/**
* CONSTRUCTION PHASE ONLY
* Add a mask layer associated with a LayerClip.
*/
void AddAncestorMaskLayer(const RefPtr<Layer>& aLayer) {
mAncestorMaskLayers.AppendElement(aLayer);
Mutated();
}
/**
* CONSTRUCTION PHASE ONLY
* Tell this layer what its transform should be. The transformation
@ -1352,6 +1361,9 @@ public:
Layer* GetAncestorMaskLayerAt(size_t aIndex) const {
return mAncestorMaskLayers.ElementAt(aIndex);
}
const nsTArray<RefPtr<Layer>>& GetAllAncestorMaskLayers() const {
return mAncestorMaskLayers;
}
bool HasMaskLayers() const {
return GetMaskLayer() || mAncestorMaskLayers.Length() > 0;

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

@ -2268,6 +2268,7 @@ ContainerState::RecyclePaintedLayer(PaintedLayer* aLayer,
// Clear clip rect and mask layer so we don't accidentally stay clipped.
// We will reapply any necessary clipping.
aLayer->SetMaskLayer(nullptr);
aLayer->SetAncestorMaskLayers({});
aLayer->ClearExtraDumpInfo();
PaintedDisplayItemLayerUserData* data =
@ -4715,8 +4716,11 @@ ContainerState::SetupScrollingMetadata(NewLayerEntry* aEntry)
MOZ_ASSERT(!aEntry->mBaseScrollMetadata->HasMaskLayer());
}
// Any extra mask layers we need to attach to FrameMetrics.
nsTArray<RefPtr<Layer>> maskLayers;
// Any extra mask layers we need to attach to ScrollMetadatas.
// The list may already contain an entry added for the layer's scrolled clip
// so add to it rather than overwriting it (we clear the list when recycling
// a layer).
nsTArray<RefPtr<Layer>> maskLayers(aEntry->mLayer->GetAllAncestorMaskLayers());
for (const DisplayItemScrollClip* scrollClip = aEntry->mScrollClip;
scrollClip && scrollClip != mContainerScrollClip;
@ -5186,6 +5190,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
"Wrong layer type");
containerLayer = static_cast<ContainerLayer*>(oldLayer);
containerLayer->SetMaskLayer(nullptr);
containerLayer->SetAncestorMaskLayers({});
}
}
}