Bug 1367332 - Don't build image layer if image map is presence. r=mattwoodrow
authorMorris Tseng <mtseng@mozilla.com>
Wed, 24 May 2017 16:16:40 +0800
changeset 409552 f19a06e327df686aeb398d9e752cba8fb8dce6f3
parent 409551 ae809917d5db3293869402f858ce1cf5e4a72968
child 409553 c336400a21d7bbaf072553a4dfe39d4d297abea8
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1367332
milestone55.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 1367332 - Don't build image layer if image map is presence. r=mattwoodrow MozReview-Commit-ID: 5w43NRlTL6d
layout/generic/nsImageFrame.cpp
layout/painting/nsDisplayList.cpp
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1627,16 +1627,22 @@ nsDisplayImage::GetLayerState(nsDisplayL
   uint32_t flags = aBuilder->ShouldSyncDecodeImages()
                  ? imgIContainer::FLAG_SYNC_DECODE
                  : imgIContainer::FLAG_NONE;
 
   if (!mImage->IsImageContainerAvailable(aManager, flags)) {
     return LAYER_NONE;
   }
 
+  // Image layer doesn't support draw focus ring for image map.
+  nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
+  if (f->HasImageMap()) {
+    return LAYER_NONE;
+  }
+
   return LAYER_ACTIVE;
 }
 
 
 /* virtual */ nsRegion
 nsDisplayImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                 bool* aSnap)
 {
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4053,16 +4053,24 @@ nsDisplayImageContainer::CanOptimizeToIm
                                 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()) {
+    // Image layer doesn't support draw focus ring for image map.
+    nsImageFrame* f = static_cast<nsImageFrame*>(mFrame);
+    if (f->HasImageMap()) {
+      return false;
+    }
+  }
+
   return true;
 }
 
 void
 nsDisplayBackgroundColor::ApplyOpacity(nsDisplayListBuilder* aBuilder,
                                        float aOpacity,
                                        const DisplayItemClipChain* aClip)
 {