Bug 4937 - Images not scaling down below original size
Summary: Images not scaling down below original size
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Minor
Assignee: Nobody
URL: http://amonre.org/css/webkit-image-sc...
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-11 13:51 PDT by Denis Defreyne
Modified: 2006-11-04 13:30 PST (History)
3 users (show)

See Also:


Attachments
Test case with text (296 bytes, text/html)
2006-11-04 09:23 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Defreyne 2005-09-11 13:51:06 PDT
SUMMARY

Images with width/height set using em's will scale when the text is scaled. However, in WebKit, images 
will never be scaled down below their original size.

STEPS TO REPRODUCE

1. Load http://amonre.org/css/webkit-image-scaling/
2. Increase the text size a lot; the image will be scaled up.
3. Decrease the text size a lot; the image will *not* be scaled down.

EXPECTED RESULTS

The image should be scaled down. Its new width and height should be smaller than its original width 
and height.

ACTUAL RESULTS

The image will scale up and back down to its original size. However, it will never become smaller than it 
originally was.

NOTES

Browsers scaling the image down below its original size:

- Firefox 1.5 beta 2
- Camino 0.9a2+
- Internet Explorer/Mac 5.2.3
- Opera 7.51

Browsers *not* scaling the image down below its original size:

- iCab 3.0.0 beta
- All WebKit-based browsers, obviously ;)
Comment 1 Joost de Valk (AlthA) 2005-09-11 14:32:33 PDT
I'm sorry but this one works for me in ToT. Closing as worksforme.
Comment 2 Denis Defreyne 2005-09-11 15:17:01 PDT
This does *not* work for me in ToT (fresh build, about 5 minutes old).
Comment 3 Denis Defreyne 2005-09-11 15:18:53 PDT
Should also have mentioned that it didn't work for bdash, mitzpettel either.

(Sure, scaling down works, but the image *never* becomes smaller than its *original* size... while it 
should.)
Comment 4 Mark Rowe (bdash) 2005-09-11 15:25:09 PDT
Confirmed with ToT WebKit.
Comment 5 Eric Seidel (no email) 2005-12-28 01:39:47 PST
That's strange.  That's the behavior of AppKit's NSImageView... but should not be of our own custom 
CGImage drawing code.  Unless we've specifically coded for this behavior.  It woudl be best if this was 
reduced to an automatic DumpRenderTree compatible test case and attached to the bug (if such is even 
possible).
Comment 6 Alexey Proskuryakov 2006-11-04 09:23:45 PST
Created attachment 11380 [details]
Test case with text
Comment 7 Alexey Proskuryakov 2006-11-04 09:28:36 PST
Decreasing the text size more than once doesn't actually work - not only the image isn't scaled down, but the text size isn't changed either. WebKit should disable Safari's menu item, but it only does so after the command is invoked a few more times.

Obviously, this is what is causing such behavior:
	body {
		font-size: 62.5%;
	}
Comment 8 mitz 2006-11-04 09:54:48 PST
(In reply to comment #7)
> WebKit should
> disable Safari's menu item, but it only does so after the command is invoked a
> few more times.

I don't think it's reasonable to disable the command based on its effect on the text currently on the page (what about text with 'visibility: hidden' or 'display: none'? what if the current zoom factor becomes "ineffective" after navigation?). This particular text isn't affected by lower zoom values because of the minimum logical font size web preference (see -[WebPreferences setMinimumLogicalFontSize:]), but other text on the same page could be affected.
Comment 9 Alexey Proskuryakov 2006-11-04 13:30:59 PST
(In reply to comment #8)
> other text on the same page could be affected.

Yes, you are absolutely right - for whatever reason, I thought that the font-size of body was used to decide whether to apply the command globally, but that was clearly wrong.

So, this is all expected behavior - the size of the image is tied to text size, and since text cannot be scaled down beyond a certain limit, the image cannot either.