Bug 1393376 - (Part 1) Paint the item when its type is TYPE_FILTER during WebRenderFallbackData generating; r=jrmuizel
MozReview-Commit-ID: JxNa1OGrSVb
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -549,41 +549,49 @@ WebRenderLayerManager::GenerateFallbackD
LayerIntSize imageSize = RoundedToInt(bounds.Size());
aImageRect = LayerRect(LayerPoint(0, 0), LayerSize(imageSize));
if (imageSize.width == 0 || imageSize.height == 0) {
return nullptr;
}
aOffset = RoundedToInt(bounds.TopLeft());
- nsRegion invalidRegion;
+
+ bool needPaint = true;
nsAutoPtr<nsDisplayItemGeometry> geometry = fallbackData->GetGeometry();
- if (geometry) {
+
+ // nsDisplayFilter is rendered via BasicLayerManager which means the invalidate
+ // region is unknown until we traverse the displaylist contained by it.
+ if (geometry && !fallbackData->IsInvalid() &&
+ aItem->GetType() != DisplayItemType::TYPE_FILTER) {
nsRect invalid;
+ nsRegion invalidRegion;
+
if (aItem->IsInvalid(invalid)) {
invalidRegion.OrWith(clippedBounds);
} else {
nsPoint shift = itemBounds.TopLeft() - geometry->mBounds.TopLeft();
geometry->MoveBy(shift);
aItem->ComputeInvalidationRegion(aDisplayListBuilder, geometry, &invalidRegion);
nsRect lastBounds = fallbackData->GetBounds();
lastBounds.MoveBy(shift);
if (!lastBounds.IsEqualInterior(clippedBounds)) {
invalidRegion.OrWith(lastBounds);
invalidRegion.OrWith(clippedBounds);
}
}
+ needPaint = !invalidRegion.IsEmpty();
}
- gfx::SurfaceFormat format = aItem->GetType() == DisplayItemType::TYPE_MASK ?
- gfx::SurfaceFormat::A8 : gfx::SurfaceFormat::B8G8R8A8;
- if (!geometry || !invalidRegion.IsEmpty() || fallbackData->IsInvalid()) {
+ if (needPaint) {
+ gfx::SurfaceFormat format = aItem->GetType() == DisplayItemType::TYPE_MASK ?
+ gfx::SurfaceFormat::A8 : gfx::SurfaceFormat::B8G8R8A8;
if (gfxPrefs::WebRenderBlobImages()) {
bool snapped;
bool isOpaque = aItem->GetOpaqueRegion(aDisplayListBuilder, &snapped).Contains(clippedBounds);
RefPtr<gfx::DrawEventRecorderMemory> recorder = MakeAndAddRef<gfx::DrawEventRecorderMemory>();
// TODO: should use 'format' to replace gfx::SurfaceFormat::B8G8R8A8. Currently blob image doesn't support A8 format.
RefPtr<gfx::DrawTarget> dummyDt =
gfx::Factory::CreateDrawTarget(gfx::BackendType::SKIA, gfx::IntSize(1, 1), gfx::SurfaceFormat::B8G8R8A8);