From e00369c44eac18403568516508937160052132c6 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 11 Nov 1999 00:58:42 +0000 Subject: [PATCH] set the default image size to be small in order to avoid obvious reflows when button code would assume 30x30 before it loaded the image (r=evaughan). --- layout/xul/base/src/nsTitledButtonFrame.cpp | 22 +++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/layout/xul/base/src/nsTitledButtonFrame.cpp b/layout/xul/base/src/nsTitledButtonFrame.cpp index fbcf48c3eb31..2f34e20f58ba 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -1340,16 +1340,17 @@ nsTitledButtonFrame::GetImageSize(nsIPresContext* aPresContext) { nsSize s(0,0); nsHTMLReflowMetrics desiredSize(&s); + const PRInt32 kDefaultSize = 10; + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + const PRInt32 kDefaultSizeInTwips = NSIntPixelsToTwips(kDefaultSize, p2t); + // not calculated? Get the intrinsic size if (mHasImage) { // get the size of the image and set the desired size if (mSizeFrozen) { - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - int v = NSIntPixelsToTwips(30, p2t); - - mImageRect.width = v; - mImageRect.height = v; + mImageRect.width = kDefaultSizeInTwips; + mImageRect.height = kDefaultSizeInTwips; return; } else { // Ask the image loader for the *intrinsic* image size @@ -1357,13 +1358,8 @@ nsTitledButtonFrame::GetImageSize(nsIPresContext* aPresContext) if (desiredSize.width == 1 || desiredSize.height == 1) { - // Use temporary size of 30x30 pixels until the size arrives - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - int v = NSIntPixelsToTwips(30, p2t); - - mImageRect.width = v; - mImageRect.height = v; + mImageRect.width = kDefaultSizeInTwips; + mImageRect.height = kDefaultSizeInTwips; return; } }