зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
275e342451
Коммит
bf446fb3e7
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче