Last Comment Bug 573967 - Minimum font size not exposed
: Minimum font size not exposed
Status: NEW
[firebug-p2]
: student-project
Product: Core
Classification: Components
Component: DOM: CSS Object Model (show other bugs)
: unspecified
: x86 Windows 7
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
https://getfirebug.com/tests/css/issu...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-23 05:33 PDT by Sebastian Zartner
Modified: 2014-07-16 04:36 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Sebastian Zartner 2010-06-23 05:33:02 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4

Currently the minimum font size defined via the options can't be retrieved via the API.
Firebug displays the CSS styles assigned to an HTML node in it's Style Side Panel.

Reproducible: Always

Steps to Reproduce:
See the test case URL.
Actual Results:  
The minimum font size is not shown inside the Style Side Panel. Same problem appears when using the DOM Inspector. Also the computed styles are giving the wrong value.

Expected Results:  
The minimum font size should be exposed via the API like all other styles.
Comment 1 Jan Honza Odvarko [:Honza] 2010-06-23 06:31:57 PDT
Trying to set proper target component to get attention.
Honza
Comment 2 Rob Campbell [:rc] (:robcee) 2010-06-23 06:58:48 PDT
Can't be retrieved by which API? You can retrieve the minimum font size through preferences:

e.g., font.minimum-size.x-western

replace x-western for the locale you're interested in.

Reopen if you have some other API you need.
Comment 3 Rob Campbell [:rc] (:robcee) 2010-06-23 07:00:09 PDT
I typed too soon. Sorry Sebastian, I understand what you're asking for now. You think the minimumFontSize should be on the DOM node's style object.
Comment 4 Boris Zbarsky [:bz] (Out June 25-July 6) 2010-06-23 10:51:21 PDT
We can't do what comment 3 proposes, since that would pollute the namespace.  Furthermore, the minimum font size isn't actually a CSS property at all, so it makes no sense to expose it as one.

So what _is_ this bug asking for?
Comment 5 Rob Campbell [:rc] (:robcee) 2010-06-23 11:51:55 PDT
I believe he's asking for what I said in c#3, but hopefully he'll correct me if I'm wrong.
Comment 6 Boris Zbarsky [:bz] (Out June 25-July 6) 2010-06-23 11:56:18 PDT
Well, c#3 as written is wontfix due to likelihood of breaking the web.
Comment 7 Sebastian Zartner 2010-06-23 14:07:48 PDT
Sorry for not writing earlier, needed to see Germany winning against Ghana. ;-)
Well, I just joined the Firebug team lately, maybe Honza or John can tell more here. But Rob is right. What I mean is to be able to access it via the style object. See therefore http://code.google.com/p/fbug/source/browse/branches/firebug1.6/content/firebug/css.js#455 and its callers. Boris, if that polluted the namespace, then there should be another solution for that, because this is not just missing in Firebug, but (as already mentioned) in DOM Inspector, too.
And for the computed styles the minimum font size is also not taken into account. Should this be put into a second issue or is that related?
Comment 8 Rob Campbell [:rc] (:robcee) 2010-06-23 14:27:44 PDT
presumably the browser's just overriding the font size if it sees something smaller than minimum. After Boris' comment and thinking about it a bit more, I'm not sure this belongs in the style object. It's a browser property.

Maybe Firebug could check the minimum font size preference and notify the user that they're using a smaller than minimum setting? Maybe throw it out as a CSS error in the Console?
Comment 9 Sebastian Zartner 2010-06-23 14:49:02 PDT
It's just a user preference, so actually it's not an error when the minimum size is used instead of the one defined in the CSS.
Boris is right saying, that the minimum font size is not a CSS property, though it's influencing how the content of a page is displayed.
I think it would be applicable to check the preference. Honza, what do you say?
What about the computed styles?
Comment 10 Boris Zbarsky [:bz] (Out June 25-July 6) 2010-06-23 16:28:11 PDT
The min font size pref affects the used style.  It does not affect computed style.  If it did, it would screw up cases like this:

  <span style="font-size: smaller">
    <span style="font-size: larger">text</span>
  </span>

if the normal font size is above the cutoff but the smaller size is below it.

I have no problem adding a Moz* getter of some sort on the computed style object to get the result of applying the min-font-size pref.  

Checking the pref in firebug seems like a bad approach, since you don't know _which_ pref to check, necessarily.
Comment 11 Sebastian Zartner 2010-10-20 01:37:50 PDT
What we are talking about here is what the W3C calls "Actual value" (http://www.w3.org/TR/CSS2/cascade.html#value-stages).
So the Moz* getter you're discribing should return this value.

Though I wonder why the W3C specified the function getComputedStyle() for returning computed values, but no API for returning used and actual values, when they are already having seperate definitions for these values. I think it would be very useful to have additional functions getUsedStyle() and getActualStyle(). Maybe somebody they are listening to should tell them...
Comment 12 Boris Zbarsky [:bz] (Out June 25-July 6) 2010-10-20 05:33:25 PDT
> Though I wonder why the W3C specified the function getComputedStyle() for
> returning computed values, but no API for returning used and actual values,
> when they are already having seperate definitions for these values.

Because they did not have used or actual values back when getComputedStyle was specified.
Comment 13 Boris Zbarsky [:bz] (Out June 25-July 6) 2010-10-20 05:35:11 PDT
If someone wants to implement this, here's the current getter for font-size in computed style:


1241 nsresult
1242 nsComputedDOMStyle::DoGetFontSize(nsIDOMCSSValue** aValue)
1243 {
1244   nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
1245   NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
1246 
1247   // Note: GetStyleFont()->mSize is the 'computed size';
1248   // GetStyleFont()->mFont.size is the 'actual size'
1249   val->SetAppUnits(GetStyleFont()->mSize);
1250 
1251   NS_ADDREF(*aValue = val);
1252   return NS_OK;
1253 }

The quantity you want would be gotten the same way but using mFont.size instead of mSize.
Comment 14 Sebastian Zartner [:sebo] 2014-07-16 04:36:54 PDT
Could this also be marked as [good first bug]?

Sebastian

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