Closed Bug 248837 Opened 20 years ago Closed 20 years ago

Percentage font sizes of 1px result in 13px sized text

Categories

(Core Graveyard :: GFX: Mac, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Informity, Assigned: jhpedemonte)

Details

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040517 Camino/0.8b
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040517 Camino/0.8

When you set the font-size attribute of an element through CSS to 1px, then
inside that set the text to any percentage value (such as 90%), the text renders
at 13px. This only appears on the macintosh, and is happening with Camino,
Mozilla and Firefox.

Reproducible: Always
Steps to Reproduce:
<span style="font-size: 1px; font-family: verdana">
	<span style="font-size: 90%">
		90% of 1px
	</span>
</span>
<span style="font-size: 13px; font-family: verdana">
	is apparently 13px?
</span>
Actual Results:  
All text was rendered at 13px

Expected Results:  
Only second piece of text should be 13px - '90% of 1px' should be very small.

I'm using Mac OS X version 10.3.4
Assignee: general → sfraser
Component: Browser-General → GFX: Mac
QA Contact: general
Attached file Testcase
Testcase that doesn't show the issue for me.

Do you have a min font size set in the prefs?
No minimum font size set. Your test case --  the 1px font renders at 1px, but
the 90% of 1px still renders at 13px. Doesn't appear to be any kind of
system-wide setting as other browsers (any not based on Gecko) render it fine.
Screenshot of what I see added
Looks to me like bug 53995 and/or bug 187889.
I can confirm this bug with Simon's testcase.  If I set the minimum font size in
Firefox to it's lowest setting (6), then the testcase works as expected.  So
we're probably not handling a less than 1px case somewhere.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Javier, do you have time to work on this? I don't, alas.
Assignee: sfraser → jhpedemonte
Attached patch patch (obsolete) — Splinter Review
This one line was setting textSize to 0 in this case, and when ::TextSize is
called with 0, it sets the font size to the system default (usually 12 points).
Attachment #152031 - Flags: review?(sfraser)
Comment on attachment 152031 [details] [diff] [review]
patch

It might be a little cleaner not to put the division inside the PR_MAX macro. 
PR_MAX evaluates its arguments multiple times, and it's also probably simpler
to do integer < rather than floating-point <.
Attached patch patch v1.1Splinter Review
New patch per dbaron's comments.
Attachment #152031 - Attachment is obsolete: true
Attachment #152040 - Flags: superreview?(dbaron)
Attachment #152040 - Flags: review?(sfraser)
Attachment #152040 - Flags: superreview?(dbaron) → superreview+
Simon, can you take a look at the patch, so we can close out this bug?
Attachment #152040 - Flags: review?(sfraser) → review+
Checked in on trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: