Closed Bug 590868 Opened 14 years ago Closed 14 years ago

"Fit Image to Window" is broken.

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 585371

People

(Reporter: vshalimhr, Unassigned)

Details

(Whiteboard: regressionwindow-wanted)

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows NT 5.2; rv:2.0b4pre) Gecko/20100817 SeaMonkey/2.1a3
Build Identifier: Mozilla/5.0 (Windows NT 5.2; rv:2.0b4pre) Gecko/20100817 SeaMonkey/2.1a3

I don't know the "official" name for the feature I'm talking about, so I'll call it "Fit Image to Window" - by the context menu item title.

The problem is the "Fit Image to Window" feature stops working after reopening an image. I think this has something to do with the fact an image is in the browser memory cache. I think this is not related to the disk cache because the bug is reproducible with local files which, according to what the browser says, are not cached on disk.


Reproducible: Always

Steps to Reproduce:
1. Open an image in browser. One of the image dimensions (width/height) must be greater than browser's window width/height so that the "Fit Image to Window" feature would have a work to do.
2. Hover the mouse cursor over the image to see if the "Fit Image to Window" is working: the mouse cursor should change to the magnifying glass icon. Right click the image and see if the "Fit Image to Window" context menu item is enabled - it should be. Clicking the image should resize it. Also, notice that tab/window title displays image dimensions right after the image type, e.g. "1234.jpg (JPEG Image, 2000x2000 pixels)".
3. Reopen (NOT reload) the image: set the input focus to the location bar and press Enter, or click the "Go" button on the navigation toolbar.

Actual Results:  
After reopening the image, the "Fit Image to Window" feature is not working:
1) Hovering the mouse over the image doesn't change the mouse cursor to the magnifying glass icon.
2) Clicking the image does not resize it.
3) The "Fit Image to Window" context menu item is disabled.
4) Browser's tab/window title doesn't display image dimensions, e.g. "1234.jpg (JPEG Image)" instead of "1234.jpg (JPEG Image, 2000x2000 pixels)". And this is true for images of any dimensions, not only those with dimensions greater than browser's window width/height.


Expected Results:  
The "Fit Image to Window" should work.


Reloading the image makes the "Fit Image to Window" feature work again - just untill you reopen the image again. And sometimes a "soft" reload (F5) is not enough and you need to do a "hard" reload with Ctrl+F5 (or by clicking the "Reload" button with the Shift key held down).
Image for testing. Right click the image and click the "View Image" context menu item. The "Fit Image to Window" should work but it doesn't: no magnifying glass mouse cursor, no resizing on clicking, and, as a bonus, no image dimensions in tab/window title.
Weird. Couldn't reproduce using the attached image.

But it's always reproducible here:
http://img149.imagevenue.com/img.php?image=08149_1234_122_536lo.jpg
To reproduce you need to wait until the image is fully loaded, then right click it and click the "View Image" context menu item - the "Fit Image to Window" will not work.

Browser says both images are in disk cache, but it reloads the attached image on every request as if for the first time. The image at imagevenue.com has the "Last-Modified" header whereas the attached image doesn't have one - maybe this affects what's stored in memory cache and what's not?
I can reproduce it with Mozilla/5.0 (X11; Linux x86_64; rv:2.0b5pre) Gecko/20100827 SeaMonkey/2.1b1pre and Mozilla/5.0 (X11; Linux i686 (x86_64); rv:2.0b5pre) Gecko/20100827 Minefield/4.0b5pre

I saved the attached image in /tmp. First load is fine and I get the following message in the console:

Document file:///tmp/08149_1234_122_536lo.jpg loaded successfully

If I reopen the image as stated in STR 3 in #c0 I get an error message:

Error loading URL file:///tmp/08149_1234_122_536lo.jpg : 805d0021

The image is still shown, but gets zoomed to its original size and fit image to window doesn't work until a forced reload.

Moving it to Core - General, since I don't know what component it really fits in.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows Server 2003 → All
Product: SeaMonkey → Core
QA Contact: general → general
Hardware: x86 → All
Version: unspecified → Trunk
It regressed somewhere between Firefox 4.0b2 and 4.0b3.

Works: Mozilla/5.0 (X11; Linux i686 (x86_64); rv:2.0b2) Gecko/20100720 Firefox/4.0b2

Broken: Mozilla/5.0 (X11; Linux i686 (x86_64); rv:2.0b3) Gecko/20100805 Firefox/4.0b3

Don't have the time to narrow down the regression range, setting regressionwindow-wanted keyword.
Whiteboard: regressionwindow-wanted
Sounds like a regression from either the async changes or discarding?
blocking2.0: --- → ?
Component: General → ImageLib
QA Contact: general → imagelib
(In reply to comment #5)
> Sounds like a regression from either the async changes or discarding?

Probably. I'll wait for the proper regression window.
Yes, this definitely has something to do with the memory cache. The FItW
feature stops working until an image is unloaded from either
"images/content/unused/uncompressed" or "gfx/surface/win32" memory cache (cache
names are copied from the "about:memory" output). I can't tell more
specifically because those two caches are cleared (and filled) in sync on my
system. I'd say it's the former one since I think it's the first place an image
is placed to after it has been parsed and uncompressed (of even while being
uncompressed), but I could be wrong since I know nothing about SeaMonkey's
cache system.

I'll attach a test page so that you can see this is related to memory cache.
How to use:
1) Open "about:memory" in a separate window.
2) Enter "javascript:setInterval(updateMemoryStatus,500);void(0);" without the quotes in the location bar - this will start updating memory stats every 500 milliseconds.
3) Notice the sizes of "images/content/unused/uncompressed" and "gfx/surface/win32" caches.
4) Open the test page (1234_timer.html) in a separate window. It's just a script that changes two images (a 2000x2000 big one and its 150x150 smaller version) in an iframe in a specified time interval (basically, it's a slideshow).
5) Notice that sizes of the mentioned caches are now increased by 16 million bytes - this is the size of big image uncompressed.
6) Set the "Interval" value to 10 seconds. I think this may depend on your system/environment, so you may need to increase it if 10 is not working for you. Or you can stop the slideshow by clicking the "Stop" button and wait.
7) Before clicking the "Start" button make sure the FItW is working in the iframe: hovering the mouse over the image should change the mouse cursor to the magnifying glass icon, and clicking the image should resize it.
8) Click the "Start" button. The slideshow should begin and the images should change each other until you click the "Stop" button.

While the slideshow goes, watch the sizes of the mentioned caches. You'll notice that if they decrease by the size of the big image (16 million bytes) while the small image is displayed (meaning the big image has been unloaded from cache), then the FItW will work when the script changes the small image to the big one. Otherwise it won't.
Test image for use with the 1234_timer.html test page. For the big 2000x2000 image use this image: https://bugzilla.mozilla.org/attachment.cgi?id=469393&action=edit
Attachment #469393 - Attachment description: Test image. → 1234.jpg - big 2000x2000 test image.
Forgot to mention the "worst" part. Sometimes (now always, but in most cases) image is not unloaded from cache even after you closed its tab. So, to get the feature working again, you have to close the whole window the tab was in.
(In reply to comment #10)
> Forgot to mention the "worst" part. Sometimes (now always, but in most cases)
> image is not unloaded from cache even after you closed its tab. So, to get the
> feature working again, you have to close the whole window the tab was in.

You can also clear your browser cache, which clears the image cache post bug 576621.
Maybe this is duplicate of Bug 585371
Status: NEW → RESOLVED
blocking2.0: ? → final+
Closed: 14 years ago
Resolution: --- → DUPLICATE
blocking2.0: final+ → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: