Bug 118413 - Percentage-based font-size is ignored below 56%
Summary: Percentage-based font-size is ignored below 56%
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.8
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-07-05 06:09 PDT by Razvan Caliman
Modified: 2022-07-13 14:55 PDT (History)
4 users (show)

See Also:


Attachments
reproducing test case (1.07 KB, text/html)
2013-07-05 06:09 PDT, Razvan Caliman
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Razvan Caliman 2013-07-05 06:09:35 PDT
Created attachment 206143 [details]
reproducing test case

In the attached test case, the third box should be visibly smaller than the first and second boxes. All boxes have the same em-based dimensions. Only the font-size varies.

Percentage-based font-size is ignored below 56%. Computed styles for `font-size: 25%` and `font-size: 56%` are the same.

Reproduces in Chrome & Safari. 
Works correctly in Firefox 22.0.
Comment 1 Mihnea Ovidenie 2013-07-05 10:03:19 PDT
There is a comment on StyleResolver::getComputedSizeFromSpecifiedSize that i think it applies in your case:
"
// We support two types of minimum font size. The first is a hard override that applies to
// all fonts. This is "minSize." The second type of minimum font size is a "smart minimum"
// that is applied only when the Web page can't know what size it really asked for, e.g.,
// when it uses logical sizes like "small" or expresses the font-size as a percentage of
// the user's default font setting.

// With the smart minimum, we never want to get smaller than the minimum font size to keep fonts readable.
// However we always allow the page to set an explicit pixel size that is smaller,
// since sites will mis-render otherwise (e.g., http://www.gamespot.com with a 9px minimum).
"
In WebPreferencesStore.h, the smart minimum value is defined:
macro(MinimumLogicalFontSize, minimumLogicalFontSize, UInt32, uint32_t, 9)

So, in your case, you cannot go below 9px for the font size and i do not think this is customizable.
56% just happens to reach the 9 limit for the default font size of 16 (9/16 = 0.56).
Comment 2 Brent Fulgham 2022-07-13 14:54:52 PDT
This continues to be a bug in Safari 15.
Comment 3 Radar WebKit Bug Importer 2022-07-13 14:55:13 PDT
<rdar://problem/96975470>