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
This commit is contained in:
buster%netscape.com
2000-05-14 04:46:19 +00:00
parent e7bd6199bd
commit 8d08d0dae5

View File

@@ -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;