W3C home > Mailing lists > Public > www-style@w3.org > June 2009

Computed Value of properties in splitted elements (was: [css3-transitions] transitions and rendering objects vs. DOM nodes)

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Sat, 27 Jun 2009 21:39:26 +0200
Message-ID: <65307430906271239o1851881eic54d06cd3f73556b@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style@w3.org
2009/6/27 L. David Baron <dbaron@dbaron.org>:
> On Saturday 2009-06-27 16:25 +0200, Giovanni Campagna wrote:
>> This is not a css3-transition issue, but rather a css2 issue, namely:
>> what is the Computed Value for color for "a"?
>> In fact, a lot of places in css2 and css3 modules assumes a mapping
>> like (element, property) => (computed value), which is generally true,
>> as long as you don't use line level pseudo-elements (currently only
>> ::first-line, in the future, who knows?)
>> Other pseudo-elements also cause similar problems (in particular
>> ::selection and ::first-letter), although they're either unspecified
>> or undefined when problematic.
>> This means that neither css3-selectors nor css2 can advance to cr / pr
>> without resolving this issue. I guess the best place to solve it would
>> be css3-cascade, since it involves finding inherited and specified
>> values for splitted elements.
> If you think there are problems with the concept of "Computed Value"
> in those drafts, please raise them in a *separate* thread (and
> explain why they are problems).

(continuing your <p><a> example, for brevity)

First of all, "Computing a value never requires the user agent to
render the document." (CSS2, 6.1.2). This means that ::first-line
cannot be used to find a Computed Value. This in turn means that the
"color" of "p > a", all of it, is "gray".

Working down to the Actual Value, I see nothing that prevents me from
using "gray" (assuming OS dithering if natural colors are not
available), this means that all the text in the "a" will be rendered
in gray. This is not true in existing implementations.
So we must assume that in some way line level pseudo-elements affect
the Actual Values of children.

There are three ways to put this:

1- There are two distinct "a" elements, one inside "p::first-line",
the other sibling of "p::first-line", child of "p". This is the
current approach in css2 and css3-selectors.
The problem is that this requires knowing what is inside the
first-line, which in turn requires rendering, and you need Computed
Values for rendering.

2- There are two Computed Values for "a", one is "gray", the other is
"black". Elements that are completely inside the first line inherit
"black", elements that are completely outside get "gray", element
splitted gets both.
This is a big change from the current CSS model.

3- The Computed Values completely ignore the existance of
"::first-line" pseudo-elements and it is just "gray", as it would
normally be.
Then we change css2 5.12.1 and css3-selectors 7.1 to say:

A line-level pseudo-element represents a line box of its superior
parent. The background properties, as well as  "line-height",
"vertical-align" and "text-decoration", apply to line boxes. These
properties don't affect inline boxes inside the line box, just adding
a background layer and a text decoration on bottom of existing ones.
Only block-level, inline-block, table-caption and table-cell elements
may be superior parents of a _line level_ pseudo-element.

In addition, the font properties, "word-spacing", "letter-spacing" and
"text-transform" may be specified on line-level pseudo-elements to
affect the children. Inline boxes that
- are descendant of the element
- belongs to an element (or structural pseudo-element) that have a
Specified Value for the relevant properties of "inherit", which
includes not having one, since those properties are inherited by
instead of finding the Used Value from the Computed Value of the
element they belong, they find it from the innermost line- level
pseudo-element representing the line box in which they reside, if a
value is specified explicitly.

CSS2 only defines one line-level pseudo-element, :first-line,
representing the first line box. Future versions of CSS may add more.

The effect should be the same as currently specified, without
splitting the element, but just the generated boxes.


PS: this affects also ::first-letter, but CSS2 leaves undefined the
case of multiple letters in the pseudo-element, so have more time to
solve it in CSS3 or 4.
Received on Saturday, 27 June 2009 19:40:08 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:27 UTC