Bug 1512524. Make all in-tree IsImageFrame checks also check for IsImageControlFrame because that is what they actually want. r=dholbert
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 06 Dec 2018 23:24:22 -0500
changeset 508807 a2998e60b98b2a5286a9bfd6661f0508d850cb72
parent 508806 5b5f5accfcae2bb9a1642fc6b0987937687efe82
child 508808 e766954700c7e9999d199bfa522afa3617f03d21
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1512524
milestone65.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 1512524. Make all in-tree IsImageFrame checks also check for IsImageControlFrame because that is what they actually want. r=dholbert
layout/generic/nsImageFrame.cpp
layout/painting/nsDisplayList.cpp
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1643,22 +1643,21 @@ bool nsDisplayImage::CreateWebRenderComm
     mozilla::wr::DisplayListBuilder& aBuilder,
     mozilla::wr::IpcResourceUpdateQueue& aResources,
     const StackingContextHelper& aSc, WebRenderLayerManager* aManager,
     nsDisplayListBuilder* aDisplayListBuilder) {
   if (!mImage) {
     return false;
   }
 
-  if (mFrame->IsImageFrame()) {
-    // Image layer doesn't support draw focus ring for image map.
-    nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
-    if (f->HasImageMap()) {
-      return false;
-    }
+  MOZ_ASSERT(mFrame->IsImageFrame() || mFrame->IsImageControlFrame());
+  // Image layer doesn't support draw focus ring for image map.
+  nsImageFrame* frame = static_cast<nsImageFrame*>(mFrame);
+  if (frame->HasImageMap()) {
+    return false;
   }
 
   uint32_t flags = imgIContainer::FLAG_ASYNC_NOTIFY;
   if (aDisplayListBuilder->IsPaintingToWindow()) {
     flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
   }
   if (aDisplayListBuilder->ShouldSyncDecodeImages()) {
     flags |= imgIContainer::FLAG_SYNC_DECODE;
@@ -1704,20 +1703,17 @@ bool nsDisplayImage::CreateWebRenderComm
       break;
   }
 
   // The previous image was not used, and is different from the current image.
   // We should forget about it. We need to update the frame as well because the
   // display item may get recreated.
   if (updatePrevImage) {
     mPrevImage = mImage;
-    if (mFrame->IsImageFrame()) {
-      nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
-      f->mPrevImage = f->mImage;
-    }
+    frame->mPrevImage = frame->mImage;
   }
 
   // If the image container is empty, we don't want to fallback. Any other
   // failure will be due to resource constraints and fallback is unlikely to
   // help us. Hence we can ignore the return value from PushImage.
   if (container) {
     aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources,
                                          aSc, destRect);
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4502,17 +4502,17 @@ bool nsDisplayImageContainer::CanOptimiz
       gfxSize(destRect.width / imageWidth, destRect.height / imageHeight);
 
   if (scale.width < 0.34 || scale.height < 0.34) {
     // This would look awful as long as we can't use high-quality downscaling
     // for image layers (bug 803703), so don't turn this into an image layer.
     return false;
   }
 
-  if (mFrame->IsImageFrame()) {
+  if (mFrame->IsImageFrame() || mFrame->IsImageControlFrame()) {
     // Image layer doesn't support draw focus ring for image map.
     nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
     if (f->HasImageMap()) {
       return false;
     }
   }
 
   return true;