Backed out changeset 93f722efcdec (bug 1145903) for causing bug 1251796.
authorTimothy Nikkel <tnikkel@gmail.com>
Sat, 27 Feb 2016 12:53:28 -0600
changeset 285876 34c4f2fb86e9db53b63df12c6c50cc370a0fccc1
parent 285875 62b2390a22b28cda8000e5a1524ab96104361900
child 285877 7314001ba54ce6358b7090c488130738d50858fb
push id72561
push usertnikkel@gmail.com
push dateSat, 27 Feb 2016 18:54:36 +0000
treeherdermozilla-inbound@34c4f2fb86e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1145903, 1251796
milestone47.0a1
backs out93f722efcdecf28ac74eddf36abd17697c06cfc7
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
Backed out changeset 93f722efcdec (bug 1145903) for causing bug 1251796.
dom/html/ImageDocument.cpp
dom/html/ImageDocument.h
layout/style/ImageDocument.css
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -334,16 +334,22 @@ ImageDocument::ShrinkToFit()
   if (!mImageContent) {
     return;
   }
   if (GetZoomLevel() != mOriginalZoomLevel && mImageIsResized &&
       !nsContentUtils::IsChildOfSameType(this)) {
     return;
   }
 
+  // Keep image content alive while changing the attributes.
+  nsCOMPtr<nsIContent> imageContent = mImageContent;
+  nsCOMPtr<nsIDOMHTMLImageElement> image = do_QueryInterface(mImageContent);
+  image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)));
+  image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)));
+  
   // The view might have been scrolled when zooming in, scroll back to the
   // origin now that we're showing a shrunk-to-window version.
   ScrollImageTo(0, 0, false);
 
   if (!mImageContent) {
     // ScrollImageTo flush destroyed our content.
     return;
   }
--- a/dom/html/ImageDocument.h
+++ b/dom/html/ImageDocument.h
@@ -109,19 +109,16 @@ protected:
   nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
   nsresult OnLoadComplete(imgIRequest* aRequest, nsresult aStatus);
   void OnHasTransparency();
 
   nsCOMPtr<nsIContent>          mImageContent;
 
   float                         mVisibleWidth;
   float                         mVisibleHeight;
-  // XXX: The image width/height isn't invalidated to reflect the up-to-date
-  //      width/height of the image frame. In particular when the
-  //      StyleVisibility orientation changes this value isn't updated.
   int32_t                       mImageWidth;
   int32_t                       mImageHeight;
 
   bool                          mResizeImageByDefault;
   bool                          mClickResizingEnabled;
   bool                          mImageIsOverflowingHorizontally;
   bool                          mImageIsOverflowingVertically;
   // mImageIsResized is true if the image is currently resized
--- a/layout/style/ImageDocument.css
+++ b/layout/style/ImageDocument.css
@@ -10,19 +10,16 @@
 
 @media not print {
   .overflowingVertical, .overflowingHorizontalOnly {
     cursor: zoom-out;
   }
 
   .shrinkToFit {
     cursor: zoom-in;
-    width: 100%;
-    height: 100%;
-    object-fit: contain;
   }
 }
 
 @media print {
   /* We must declare the image as a block element. If we stay as
   an inline element, our parent LineBox will be inline too and
   ignore the available height during reflow.
   This is bad during printing, it means tall image frames won't know