Re: Initial Value

Felix Miata wrote:
> I'm trying to better understand. But once again I refer you to the
> actual language at http://www.w3.org/TR/CSS21/fonts.html#propdef-font
> 
> "<em><b>All</b></em> font-related properties
> <em>are first reset to their
> <b>initial values</b></em>, ... 
> <em>Then</em> those properties that are given explicit values in the
> 'font' shorthand are set to those values." (emphasis supplied)

Right.  This is the section that describes what specified values the "font" 
shorthand produces.  Again, it sounds to me like you have a fundamental 
misunderstanding of the relationship between specified, computed, and used values.

The relationship is as follows.  When laying out a box for a node:

1)  Make a list of all declarations that apply to that node in cascade order 
(from least important to most important, with secondary sort by order in the 
stylesheet).

2)  Walk this list and determine the specified value for every property.  If a 
property is specified multiple times, the last value specified is used.  If a 
property is not specified at all, its initial value is used.

3)  Determine the computed style for the node's parent using this algorithm.

4)  Determine the computed value for each property per the instructions in the 
"Computed value" section of the property definitions.  This is where "inherit" 
is converted into a computed value, and in some (not all) cases percentage 
values are converted to absolute values in this step.

5)  Determine widths of ancestor boxes

6)  Determine the used value for each property.  At this stage, for example, 
percentage widths are converted to absolute values so that the box can be drawn.

The font shorthand affects the construction of the list in step (1) by 
introducing certain declarations into that list.  By they time you get to step 
3, the fact that a shorthand was used is no longer relevant (or even 
discoverable from the given data, which is just a list of specified values, one 
for each property)

> I think that the language here is both entirely clear and dictates a
> much better result (reset to initial value medium, then apply 70% to
> medium)

Where do you see the language dictating the "then apply" part, pray tell me?

> than what you say the cascade demands (ignore initial value
> medium (don't actually reset font-size, because we pretend the initial
> value is to be wholly disregarded when immediately within one construct
> followed by an explicit value)

Perhaps a CSS3 example would be illuminating here:

p {
   font-size: initial;
   font-size: 50%;
}

This should be completely identical to:

p {
   font-size: 50%;
}

because "initial" is just another specified value, and "50%" is specified later.

> Don't forget, font is special. Besides its purported reset function, it
> also handles specially system fonts, totally ignoring properties they
> should inherit.

I'm not sure what you mean by "ignoring".  The spec pretty clearly says:

   System fonts may only be set as a whole; that is, the font family, size,
   weight, style, etc. are all set at the same time.

That is, setting a system font means asking the system for the family, size, 
etc, etc for that font and using those as the _specified_ values at that point 
in the list being constructed in step (1) above.  Note that Gecko gets this 
wrong (for implementation reasons, not for spec-understanding reasons), if 
you're basing your conclusions on what Mozilla is doing.

-Boris

Received on Wednesday, 1 June 2005 16:42:04 UTC