Bug 1423424 - Don't use empty image containers in image layers. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Fri, 15 Dec 2017 16:20:22 -0600
changeset 396543 a74d64858b70aef7b3ebe02e205a63459122f403
parent 396542 e4d571577ef19fdf20a6a67635ea1e3d69d59ee8
child 396544 a2b87439996443fa69171fda33938c632bb1630a
push id98325
push useraosmond@gmail.com
push dateFri, 15 Dec 2017 22:20:31 +0000
treeherdermozilla-inbound@a74d64858b70 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1423424, 1368776
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1423424 - Don't use empty image containers in image layers. r=tnikkel Prior to bug 1368776, when no surface was obtained for the container, no container was returned. Since we prefer an empty image container with WebRender to avoid fallback, this was changed, but regressed non-WebRender behaviour. Now on the non-WebRender path, we check if there is anything in the container before accepting it.
layout/generic/nsImageFrame.cpp
layout/painting/nsDisplayList.cpp
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1680,17 +1680,17 @@ nsDisplayImage::BuildLayer(nsDisplayList
 {
   uint32_t flags = imgIContainer::FLAG_ASYNC_NOTIFY;
   if (aBuilder->ShouldSyncDecodeImages()) {
     flags |= imgIContainer::FLAG_SYNC_DECODE;
   }
 
   RefPtr<ImageContainer> container =
     mImage->GetImageContainer(aManager, flags);
-  if (!container) {
+  if (!container || !container->HasCurrentImage()) {
     return nullptr;
   }
 
   RefPtr<ImageLayer> layer = static_cast<ImageLayer*>
     (aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, this));
   if (!layer) {
     layer = aManager->CreateImageLayer();
     if (!layer)
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4546,17 +4546,22 @@ nsDisplayImageContainer::GetContainer(La
     return nullptr;
   }
 
   uint32_t flags = imgIContainer::FLAG_ASYNC_NOTIFY;
   if (aBuilder->ShouldSyncDecodeImages()) {
     flags |= imgIContainer::FLAG_SYNC_DECODE;
   }
 
-  return image->GetImageContainer(aManager, flags);
+  RefPtr<ImageContainer> container = image->GetImageContainer(aManager, flags);
+  if (!container || !container->HasCurrentImage()) {
+    return nullptr;
+  }
+
+  return container.forget();
 }
 
 bool
 nsDisplayImageContainer::CanOptimizeToImageLayer(LayerManager* aManager,
                                                  nsDisplayListBuilder* aBuilder)
 {
   uint32_t flags = aBuilder->ShouldSyncDecodeImages()
                  ? imgIContainer::FLAG_SYNC_DECODE