Bug 1471583: Preserve the behavior of bailing out from GetSourceToDestTransform if any direction of the intrinsic size matches the destination rect. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sat, 30 Jun 2018 13:51:37 +0200
changeset 814763 28c928448b2c1e237191dc366886eec11776de4f
parent 814762 b2d1bfdc3f2958e6609e2800b66ba63eb4ce1d5b
child 814764 5d394d9ab60adc0b4d98afd5bdc0d7540109d18c
push id115332
push userbmo:emilio@crisal.io
push dateFri, 06 Jul 2018 03:43:54 +0000
bugs1471583, 1469000, 624647
milestone63.0a1
Bug 1471583: Preserve the behavior of bailing out from GetSourceToDestTransform if any direction of the intrinsic size matches the destination rect. This condition was effectively removed in bug 1469000 because I didn't think it was necessary at all. But looks like either it is (but I don't understand why), or it's wallpapering something else... Looks like this was introduced in bug 624647 and there's no comment related to why it is relevant. In any case it's harmless, as we'd overinvalidate when it's hit. MozReview-Commit-ID: 4o4RVxjBMVC
layout/generic/nsImageFrame.cpp
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -442,16 +442,22 @@ nsImageFrame::GetSourceToDestTransform(n
   // see ScaleIntrinsicSizeForDensity.
   nsSize intrinsicSize;
   if (!mImage ||
       !NS_SUCCEEDED(mImage->GetIntrinsicSize(&intrinsicSize)) ||
       intrinsicSize.IsEmpty()) {
     return false;
   }
 
+  // FIXME(emilio): Not clear to me why this is needed. See bug 1471583.
+  if (intrinsicSize.width == destRect.width ||
+      intrinsicSize.height == destRect.height) {
+    return false;
+  }
+
   aTransform.SetScale(float(destRect.width)  / float(intrinsicSize.width),
                       float(destRect.height) / float(intrinsicSize.height));
   return true;
 }
 
 // This function checks whether the given request is the current request for our
 // mContent.
 bool