diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 31c6898dd75..f4891fbb78e 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -576,7 +576,7 @@ nsImageFrame::GetDesiredSize(nsIPresContext* aPresContext, // We have a width, and an auto height. Compute height from // width once we have the intrinsic image size. if (mIntrinsicSize.height != 0) { - newHeight = mIntrinsicSize.height; + newHeight = (mIntrinsicSize.height * newWidth) / mIntrinsicSize.width; haveComputedSize = PR_TRUE; } else { newHeight = NSIntPixelsToTwips(1, p2t); // XXX? @@ -588,7 +588,7 @@ nsImageFrame::GetDesiredSize(nsIPresContext* aPresContext, // once we have the intrinsic image size. newHeight = MINMAX(heightConstraint, minHeight, maxHeight); if (mIntrinsicSize.width != 0) { - newWidth = mIntrinsicSize.width; + newWidth = (mIntrinsicSize.width * newHeight) / mIntrinsicSize.height; haveComputedSize = PR_TRUE; } else { newWidth = NSIntPixelsToTwips(1, p2t); diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 31c6898dd75..f4891fbb78e 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -576,7 +576,7 @@ nsImageFrame::GetDesiredSize(nsIPresContext* aPresContext, // We have a width, and an auto height. Compute height from // width once we have the intrinsic image size. if (mIntrinsicSize.height != 0) { - newHeight = mIntrinsicSize.height; + newHeight = (mIntrinsicSize.height * newWidth) / mIntrinsicSize.width; haveComputedSize = PR_TRUE; } else { newHeight = NSIntPixelsToTwips(1, p2t); // XXX? @@ -588,7 +588,7 @@ nsImageFrame::GetDesiredSize(nsIPresContext* aPresContext, // once we have the intrinsic image size. newHeight = MINMAX(heightConstraint, minHeight, maxHeight); if (mIntrinsicSize.width != 0) { - newWidth = mIntrinsicSize.width; + newWidth = (mIntrinsicSize.width * newHeight) / mIntrinsicSize.height; haveComputedSize = PR_TRUE; } else { newWidth = NSIntPixelsToTwips(1, p2t);