correctly determine when the image has changed sizes to avoid causing unnecessary reflows. now comparing twips to twips instead of twips to pixels. part of fix for bug #15722 (r=evaughan).

This commit is contained in:
pinkerton%netscape.com 1999-10-07 21:02:58 +00:00
Родитель 275e342451
Коммит bf446fb3e7
1 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -387,11 +387,19 @@ nsTitledButtonFrame::UpdateImage(nsIPresContext& aPresContext)
if (mImageLoader.IsImageSizeKnown()) {
nsIImage* image = mImageLoader.GetImage();
if (image && image->GetWidth() == mImageRect.width && image->GetHeight() == mImageRect.height) {
if ( image ) {
// imageLib stores width/height in pixels and we store it in twips. do the conversion
// before comparing.
float p2t = 0.0;
aPresContext.GetScaledPixelsToTwips(&p2t);
int imageWidth = NSIntPixelsToTwips(image->GetWidth(), p2t);
int imageHeight = NSIntPixelsToTwips(image->GetHeight(), p2t);
if ( imageWidth == mImageRect.width && imageHeight == mImageRect.height ) {
reflow = PR_FALSE;
Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE);
}
}
}
if (reflow) {
// Force a reflow when the image size isn't already known