Last Comment Bug 89503 - [review]font-size:0 ignored
: [review]font-size:0 ignored
Status: VERIFIED FIXED
: css1, css2, fonts
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: P3 normal (vote)
: mozilla0.9.8
Assigned To: Pierre Saslawsky
: Hixie (not reading bugmail)
Mentors:
: 89598 (view as bug list)
Depends on:
Blocks: 104166
  Show dependency treegraph
 
Reported: 2001-07-05 17:23 PDT by Aaron Kaluszka
Modified: 2002-01-14 13:35 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (786 bytes, patch)
2001-12-17 10:10 PST, Pierre Saslawsky
rbs: review+
attinasi: superreview+
Details | Diff | Splinter Review
testcase (721 bytes, text/html)
2001-12-17 10:11 PST, Pierre Saslawsky
no flags Details

Description Aaron Kaluszka 2001-07-05 17:23:22 PDT
font-size:0 does not work.. it does not matter if units are given or not.. it is
completely ignored.
CSS2 15.2.4 says font-size can take <length> (4.3.2 defined as any number) but
negative lengths are illegal.
Zero is not illegal but Mozilla treats it as such.
Comment 1 Aaron Kaluszka 2001-07-05 18:49:26 PDT
also, font-size:0.1mm doesn't work either (rounded down to 0?)
Comment 2 Aaron Kaluszka 2001-07-05 18:58:48 PDT
Also, anything below font-size:4% doesn't work either (relative to default 16px)
Comment 3 Boris Zbarsky [:bz] 2001-07-06 14:23:19 PDT
*** Bug 89598 has been marked as a duplicate of this bug. ***
Comment 4 Aaron Kaluszka 2001-07-06 14:59:43 PDT
From DUP bug 89590: "It's a severe limitation. IE 5 makes text invisible, and 
it's extremely useful - e.g. using this feature you can turn "annotated 
version" of your document to "not annotaed" by just setting font size to 0pt in 
CSS for "div.annotation" style (provided all annotations are enclosed as "<div 
class=annotation></div>')."

I'd also like to add that it is necessary for certain Standards mode 
compatibility issues.  In order to truly remove those bug 22274 "image 
descenders" a font-size of zero applied to the body is a workaround.
Comment 5 Christopher Hoess (gone) 2001-07-06 18:16:34 PDT
Bug 89598 is the DUP, not 89590.
Comment 6 Aaron Kaluszka 2001-07-06 18:24:33 PDT
yeah.. strike-through 8s and 0s look nearly identical
Comment 7 Aaron Kaluszka 2001-08-15 14:02:48 PDT
CSS1 5.2.6 also mentions this.  Marking css1.  Can we get an update on this one?
Comment 8 Hixie (not reading bugmail) 2001-08-16 01:14:16 PDT
rbs: This is probably an easy fix while you're in the fonts code... :-)
Comment 9 Pierre Saslawsky 2001-10-29 12:54:25 PST
"font-size: 0pt" doesn't make the text invisible on IE5/win98, it makes it 1px 
high.  On MacNav4, WinNav4 and MacIE5, the declaration is more or less ignored 
(the size is 'normal' but the line-height can be slightly affected).  Still, 
regardless of what the other browsers do, I don't think we have to worry about 
emulating their behavior.  We could just fix it.
Comment 10 Aaron Kaluszka 2001-11-07 17:31:14 PST
AFAIK IE5.5 and IE6 handle this properly, btw.
Comment 11 Pierre Saslawsky 2001-12-17 10:09:43 PST
The problem appears to be that native toolbox functions refuse to set the text 
size to 0 (eg. on the Mac, ::TextSize(0) is ignored).  Here is a patch that fixes 
the problem in XP code.

Marc/RBS: please r/sr
Comment 12 Pierre Saslawsky 2001-12-17 10:10:26 PST
Created attachment 61969 [details] [diff] [review]
patch
Comment 13 Pierre Saslawsky 2001-12-17 10:11:04 PST
Created attachment 61970 [details]
testcase
Comment 14 rbs 2001-12-18 02:04:46 PST
> The problem appears to be that native toolbox functions refuse to set the text 
> size to 0 (eg. on the Mac, ::TextSize(0) is ignored).

Similar story on Windows. There is no special-case of font-size:0 on Windows, 
and nothing is breaking down. So I was curious to understand why, and I just 
looked at the GDI documentation, and it says that when the font-size is passed 
as 0, "the font mapper uses a default height value when it searches for a 
match." In other words, the font metrics' ascent, descent, etc, are still going
to be non-zero. That may be why other browsers gave the general impression that 
the declaration is ignored. 

Looking at the patch, I first had the impression that it will achieve the same 
effect as a textframe with an empty content, and I was wondering what will 
happen when the block code will apply its min-height rule. At first, it seemed 
that things wouldn't collapse into nothingness since the line-height is 
supposedly non-zero. But after applying and testing the patch, things worked out 
well. The case that didn't work and left a visible blank line was:
<p><span style="font-size:0pt">...invisible text...</span></p>

I am leaning towards thinking that the line-height may be coming from the 
font-size. And since the block code collapses empty lineboxes in your testcase 
and its line-height is 0, it disappears... In the other case, the min-height 
applies.

Anyway r=rbs, since authors can work-around the limitation by putting the 
declaration in the correct place.

Note: might be worth special-casing font-size:0 when setting the line-height in 
bug 95267 to avoid to regress this fix.
Comment 15 rbs 2001-12-18 18:10:01 PST
Comment on attachment 61969 [details] [diff] [review]
patch

r=rbs
Comment 16 Marc Attinasi 2002-01-09 14:24:02 PST
Comment on attachment 61969 [details] [diff] [review]
patch

sr=attinasi
Comment 17 Pierre Saslawsky 2002-01-14 05:27:37 PST
fixed
Comment 18 Aaron Kaluszka 2002-01-14 13:35:02 PST
sweet

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