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; RefPtr<BasicLayerManager> tempManager;
nsIntRect intClip; nsIntRect intClip;
bool hasClip = false; bool hasClip = false;
bool havePreviousData = false;
if (aLayerState != LAYER_NONE) { if (aLayerState != LAYER_NONE) {
DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager()); DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager());
if (data) { if (data) {
tempManager = data->mInactiveManager; tempManager = data->mInactiveManager;
havePreviousData = !!data->mGeometry;
} }
if (!tempManager) { if (!tempManager) {
tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE); tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
@ -4474,7 +4476,13 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
layerBuilder->DidBeginRetainedLayerTransaction(tempManager); 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 = RefPtr<Layer> tmpLayer =
aItem->BuildLayer(mDisplayListBuilder, tempManager, ContainerLayerParameters()); aItem->BuildLayer(mDisplayListBuilder, tempManager, ContainerLayerParameters());
// We have no easy way of detecting if this transaction will ever actually get finished. // We have no easy way of detecting if this transaction will ever actually get finished.
@ -4517,29 +4525,31 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
} }
#endif #endif
nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer); if (props) {
props->MoveBy(-offset); nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr); props->MoveBy(-offset);
if (aLayerState == LAYER_SVG_EFFECTS) { nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(), if (aLayerState == LAYER_SVG_EFFECTS) {
aItem->ToReferenceFrame(), invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(),
invalid); aItem->ToReferenceFrame(),
} invalid);
if (!invalid.IsEmpty()) { }
if (!invalid.IsEmpty()) {
#ifdef MOZ_DUMP_PAINTING #ifdef MOZ_DUMP_PAINTING
if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) { 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); 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 #endif
invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale); invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale);
if (hasClip) { if (hasClip) {
invalid.And(invalid, intClip); invalid.And(invalid, intClip);
}
InvalidatePostTransformRegion(layer, invalid,
GetTranslationForPaintedLayer(layer),
paintedData);
} }
InvalidatePostTransformRegion(layer, invalid,
GetTranslationForPaintedLayer(layer),
paintedData);
} }
} }
ClippedDisplayItem* cdi = ClippedDisplayItem* cdi =