From 8d08d0dae5df3c8b2d0f92ccc9a17fe272c5e945 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Sun, 14 May 2000 04:46:19 +0000 Subject: [PATCH] bug 38396, a bug in calculation of image width given it's height and a percent width git-svn-id: svn://10.0.0.236/trunk@69634 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/base/src/nsHTMLImageLoader.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp index d8a17b8d378..5aa3a026ee5 100644 --- a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp +++ b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp @@ -20,6 +20,7 @@ * Contributor(s): */ #include "nsHTMLImageLoader.h" +#include "nsIStyleContext.h" #include "nsFrame.h" #include "nsIURL.h" #include "nsNetUtil.h" @@ -126,7 +127,6 @@ nsHTMLImageLoader::Update(nsIPresContext* aPresContext, nsIFrame* aFrame, PRUint32 aStatus) { - //printf("---------------------> nsHTMLImageLoader::Update\n"); #ifdef NOISY_IMAGE_LOADING nsFrame::ListTag(stdout, aFrame); printf(": update: status=%x [loader=%p] callBack=%p squelch=%s\n", @@ -273,7 +273,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, widthConstraint = aReflowState->mComputedWidth; minWidth = aReflowState->mComputedMinWidth; maxWidth = aReflowState->mComputedMaxWidth; - if (NS_INTRINSICSIZE != widthConstraint) { + if (NS_INTRINSICSIZE != widthConstraint && + eStyleUnit_Coord==aReflowState->mStylePosition->mWidth.GetUnit()) { fixedContentWidth = PR_TRUE; } else if (mFlags.mHaveIntrinsicImageSize) { @@ -361,6 +362,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, else if (fixedContentHeight) { // We have a height, and an auto width. Compute width from height // once we have the intrinsic image size. + + // otherwise, we really have auto-width based on height newHeight = MINMAX(heightConstraint, minHeight, maxHeight); if (mFlags.mHaveIntrinsicImageSize) { float width = (float) mIntrinsicImageSize.width; @@ -434,7 +437,10 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext, aDesiredSize.width = mComputedImageSize.width; aDesiredSize.height = mComputedImageSize.height; - +#ifdef NOISY_IMAGE_LOADING + printf("nsHTMLImageLoader::GetDesiredSize returning %d, %d\n", + aDesiredSize.width, aDesiredSize.height); +#endif if ((mFlags.mNeedIntrinsicImageSize && !mFlags.mHaveIntrinsicImageSize) || mFlags.mNeedSizeNotification) { return PR_FALSE;