Last Comment Bug 434718 - em-based font-size wrong when minimum font size set
: em-based font-size wrong when minimum font size set
Status: RESOLVED INVALID
: dev-doc-complete, regression, testcase
Product: Core
Classification: Components
Component: Layout: Text (show other bugs)
: Trunk
: x86 All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
http://www.bigbaer.com/css_tutorials/...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-20 03:42 PDT by Oliver Schoett
Modified: 2008-06-04 06:47 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
FF3 rendering (too small) (29.69 KB, image/png)
2008-05-20 03:54 PDT, Oliver Schoett
no flags Details
FF2 rendering (OK) (30.32 KB, image/png)
2008-05-20 03:54 PDT, Oliver Schoett
no flags Details
bigbear with FF2 on XP, 120dpi screen: first highlighted paragraph correctly enlarged (138.41 KB, image/png)
2008-05-28 03:28 PDT, Oliver Schoett
no flags Details
bigbear with FF3 on XP, 120dpi screen: first highlighted paragraph not enlarged = incorrect (133.80 KB, image/png)
2008-05-28 03:29 PDT, Oliver Schoett
no flags Details
Demo that em,ex units are completely different between FF2 and FF3 when minimum font size is set (763 bytes, text/html)
2008-05-29 06:24 PDT, Oliver Schoett
no flags Details
Previous demo without font-size, showing no inconsistency (693 bytes, text/html)
2008-05-29 06:47 PDT, Oliver Schoett
no flags Details
Comparison between %-based and em-based font-size scaling (1.34 KB, text/html)
2008-05-29 07:59 PDT, Oliver Schoett
no flags Details

Description Oliver Schoett 2008-05-20 03:42:04 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008051206 Firefox/3.0

FF3 RC1: font-size in em units is wrong when minimum font size is set.  The resulting font is much smaller than in FF2.

Reproducible: Always

Steps to Reproduce:
1. Set minimum font size 14 pt.
2. Visit www.fonttester.com with JavaScript enabled.
3. Select font-size: other, 1.2 em
Actual Results:  
Result with FF3 RC1: left text sample stays approx. the same size as the others

Expected Results:  
Result with FF2: left text sample becomes clearly larger than the others.

This appears to be correct.

The problem can be seen on other web pages as well that set font-size in em units.
(Unfortunately, the sample page I have is internal, so I would welcome if people could add public pages that exhibit the bug).
Comment 1 Oliver Schoett 2008-05-20 03:54:08 PDT
Created attachment 321742 [details]
FF3 rendering (too small)
Comment 2 Oliver Schoett 2008-05-20 03:54:37 PDT
Created attachment 321743 [details]
FF2 rendering (OK)
Comment 3 Oliver Schoett 2008-05-22 05:09:50 PDT
Confirmed on Linux, version
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008052213 (Gentoo) Firefox/3.0
(compiled on Gentoo)

Added keyword "regression", as it is a regression from FF2
Comment 4 Oliver Schoett 2008-05-28 03:26:23 PDT
The URL

   http://www.bigbaer.com/css_tutorials/css_font_size.htm

shows the bug very cleary: the FF2 rendering is correct, as the first highlighted paragraph obtains a font-size of roughly 1.5 * 0.8 times the size of the surrounding text.

In FF3 this paragraph is hardly enlarged at all.

It appears that the minimum font size setting is not taken into account when computing the size of an em, which is badly broken.

Screenshots will be enclosed from Windows XP
Comment 5 Oliver Schoett 2008-05-28 03:28:50 PDT
Created attachment 322756 [details]
bigbear with FF2 on XP, 120dpi screen: first highlighted paragraph correctly enlarged
Comment 6 Oliver Schoett 2008-05-28 03:29:51 PDT
Created attachment 322757 [details]
bigbear with FF3 on XP, 120dpi screen: first highlighted paragraph not enlarged = incorrect
Comment 7 Oliver Schoett 2008-05-28 03:32:00 PDT
I think this problem should be looked at before FF3 breaks website layouts all over the place -> candidate for blocking FF3
Comment 8 Mike Shaver (:shaver -- probably not reading bugmail closely) 2008-05-28 05:32:47 PDT
Not a blocker, would take a deemed-safe fix for 3.0.1; re-componentizing for better visibility by the right people.
Comment 9 Oliver Schoett 2008-05-29 01:43:31 PDT
Fixing it in 3.0.1 means that there will be layout differences between FF 2.0 and 3.0 and between FF 3.0 and 3.0.1.  This will not go down well with website authors.
Comment 10 Oliver Schoett 2008-05-29 06:24:54 PDT
Created attachment 322932 [details]
Demo that em,ex units are completely different between FF2 and FF3 when minimum font size is set

The attachment em_problem_demo.html shows that the em and ex units no longer take the minimum font size into account as they used to in FF2.  When the minimum font size exceeds the font size desired by the web page, this leads to completely different dimensions everywhere these units are used.
Comment 11 Mike Shaver (:shaver -- probably not reading bugmail closely) 2008-05-29 06:36:22 PDT
Layout can always be affected by user preferences, such as custom stylesheets, underline/colour-link preferences, or minimum font sizes, of course.

Web site authors do not need to concern themselves with 3.0 once 3.0.1 has been out for a month or so -- our users upgrade very aggressively, and 3.0.1 will be released before we offer a major update to our current FF2 users.  We can put a note in the release notes for FF3.0 to which webmasters can direct users who complain about the difference in rendering, when they have this preference set.

But we can't fix it in 3.0.1 without a patch, so if you want to help with that I would recommend trying older builds of FF3 betas and alphas to find out when the regression occurred.  Thanks for your help!
Comment 12 Mike Shaver (:shaver -- probably not reading bugmail closely) 2008-05-29 06:37:15 PDT
(This bug is not "major"; please read the descriptions at https://bugzilla.mozilla.org/page.cgi?id=fields.html#bug_severity.  It's also already marked as a regression via the keyword.  Thanks!)
Comment 13 Oliver Schoett 2008-05-29 06:47:22 PDT
Created attachment 322934 [details]
Previous demo without font-size, showing no inconsistency

Sorry, my mistake: leaving out the em-based font-size settings from the previous demo, it can be seen that the difference in the em,ex units is just a consequence of the different ways the font-size is handled between FF2 and FF3
Comment 14 Oliver Schoett 2008-05-29 07:59:19 PDT
Created attachment 322943 [details]
Comparison between %-based and em-based font-size scaling

The attachment shows that the new behaviour is probably a feature rather than a bug:  The percentage-based font scaling behaves the same in FF2 and FF3, resulting in a font that is the same size as the original font.

The em-based font scaling, however, "bounces" off the minimum font size in FF2, that is, the minimum font size affects further em-based scaling.

The new behaviour in FF3 can be summarized as follows: there is an "intended font size", which is used for calculating relative font sizes using percentages or em or ex units, and which is not affected by the minimum font size. Also, there is an "actual font size" bounded by the minimum font size, which controls the rendering of fonts and the ex,em units when not used in font-size.

In other words, the ex,em units in font-size are based on the "intended font size", in other cases they are based on the "actual font size".  When used to control font-size, these units now behave the same way as percentages in FF3.

As a bug this may therefore be regarded as invalid.  It is still a change that web designers must look out for.
Comment 15 Mike Shaver (:shaver -- probably not reading bugmail closely) 2008-05-29 08:12:44 PDT
Oliver,

I'm going to mark this INVALID, as you suggest, but I also wanted to thank you for your great analysis here.  Would you consider adding it to the documentation at http://developer.mozilla.org/en/docs/Updating_web_applications_for_Firefox_3 to help other web developers?
Comment 16 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2008-05-29 15:40:51 PDT
By default there's no minimum font size, so 99% of users won't have minimums and I doubt most Web developers care about them.

Because of that, the FF3 approach is better for users who do use minimum font sizes, because it makes fewer elements have sizes that are different to the no-minimum-size case.
Comment 17 Mike Beltzner [:beltzner, not reading bugmail] 2008-06-03 13:03:57 PDT
I don't think this is a major enough issue to relnote, but yes, we should add it to the documentation.

Note You need to log in before you can comment on or make changes to this bug.