Bug 1219020 - Don't do layer tree comparisons for inactive layer trees that have changed layers since we'll invalidate it all anyway. r=roc

--HG--
extra : rebase_source : 659233e99a8c84a7d4a097aed06adb243bd10955
This commit is contained in:
Matt Woodrow 2015-11-03 16:48:42 +13:00
Родитель 26d59a2852
Коммит 63db61e6ca
1 изменённых файлов: 30 добавлений и 20 удалений

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

@ -4432,10 +4432,12 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
RefPtr<BasicLayerManager> tempManager;
nsIntRect intClip;
bool hasClip = false;
bool havePreviousData = false;
if (aLayerState != LAYER_NONE) {
DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager());
if (data) {
tempManager = data->mInactiveManager;
havePreviousData = !!data->mGeometry;
}
if (!tempManager) {
tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
@ -4474,7 +4476,13 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
layerBuilder->DidBeginRetainedLayerTransaction(tempManager);
}
UniquePtr<LayerProperties> props(LayerProperties::CloneFrom(tempManager->GetRoot()));
// If we have previous data for this item, then we need to track changes
// to the layer tree and invalidate them. If we don't have any previous
// data then ComputeGeometryChangeForItem will invalidate the item's bounds.
UniquePtr<LayerProperties> props;
if (havePreviousData) {
props = LayerProperties::CloneFrom(tempManager->GetRoot());
}
RefPtr<Layer> tmpLayer =
aItem->BuildLayer(mDisplayListBuilder, tempManager, ContainerLayerParameters());
// We have no easy way of detecting if this transaction will ever actually get finished.
@ -4517,29 +4525,31 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
}
#endif
nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
props->MoveBy(-offset);
nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
if (aLayerState == LAYER_SVG_EFFECTS) {
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(),
aItem->ToReferenceFrame(),
invalid);
}
if (!invalid.IsEmpty()) {
if (props) {
nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
props->MoveBy(-offset);
nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
if (aLayerState == LAYER_SVG_EFFECTS) {
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(),
aItem->ToReferenceFrame(),
invalid);
}
if (!invalid.IsEmpty()) {
#ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf_stderr("Inactive LayerManager(%p) for display item %s(%p) has an invalid region - invalidating layer %p\n", tempManager.get(), aItem->Name(), aItem->Frame(), layer);
}
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
printf_stderr("Inactive LayerManager(%p) for display item %s(%p) has an invalid region - invalidating layer %p\n", tempManager.get(), aItem->Name(), aItem->Frame(), layer);
}
#endif
invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale);
invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale);
if (hasClip) {
invalid.And(invalid, intClip);
if (hasClip) {
invalid.And(invalid, intClip);
}
InvalidatePostTransformRegion(layer, invalid,
GetTranslationForPaintedLayer(layer),
paintedData);
}
InvalidatePostTransformRegion(layer, invalid,
GetTranslationForPaintedLayer(layer),
paintedData);
}
}
ClippedDisplayItem* cdi =