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

Re: [css3-transitions] transitions and rendering objects vs. DOM nodes

From: David Hyatt <hyatt@apple.com>
Date: Tue, 30 Jun 2009 17:42:08 -0500
Cc: "L. David Baron" <dbaron@dbaron.org>, www-style@w3.org
Message-id: <17333B98-1BDB-427A-89A6-55D58E047A1E@apple.com>
To: robert@ocallahan.org
On Jun 29, 2009, at 4:25 PM, Robert O'Callahan wrote:

> On Tue, Jun 30, 2009 at 2:20 AM, David Hyatt <hyatt@apple.com> wrote:
> On Jun 28, 2009, at 10:57 PM, Robert O'Callahan wrote:
>> On Sun, Jun 28, 2009 at 9:37 AM, David Hyatt <hyatt@apple.com> wrote:
>> In WebKit, at the moment we do transitions on rendering objects  
>> (and yes this means changes to display:none just kill  
>> transitions).  We don't allow transitions to occur on pseudo  
>> elements.  Not sure if this is the right decision though, but it's  
>> what we have done so far.
>>
>> What if you have a <span> which fits on one line, a transition on  
>> 'color' starts, but halfway through the container width changes so  
>> the <span> breaks across two lines? The second box gets the final  
>> color immediately? If this happened because the user resized the  
>> window, I think it's clearly a bug.
>>
>
> Unlike Gecko, our "rendering objects" are not affected by changes in  
> line structure.  We create separate objects for lines.  So what you  
> describe is not an issue in WebKit.
>
> It's better to think of transitions as happening on nodes and on  
> pseudo elements, since obviously the notion of a "rendering object"  
> isn't the same in every engine.
>
> Defining transitions on 'first-line' have nearly the same set of  
> issues as defining transitions in terms of boxes. ('before' and  
> 'after' are obviously easy since they can be considered to create  
> anonymous elements of their own.)
>
> So here's another version of my question:
> p { color:gray; }
> p::first-line { color:black; }
> a:hover { color:red; transition:3s color; }
> Suppose initially an <a> fits on the first line its parent <p>, then  
> it gets hovered, and halfway through the transition <p>'s width  
> changes so the <a> wraps to the next line. What should happen to the  
> second line of <a>? Should it start a new transition from gray to  
> red? Would the answers be different if the pseudo-element rule was  
> p::first-line { letter-spacing:1px; } ?

At the moment in WebKit, we run transitions on the styles that aren't  
pseudo-elements and that aren't affected by first-line (e.g., through  
inheritance).  In other words, it doesn't matter how many lines you  
have or what the objects are... we will transition lines 2-n and  
ignore line 1 in your example.  Our line objects simply observe the  
style on a master RenderObject (the master style caches the  
subordinate first-line style if it is different), so that transition  
would be running regardless of whether you actually had lines 2-n or  
not.

It seems like first-line is the problem case, so the options are:
(1) First-line styles transition independently from the "master" style  
you'd expect on all other lines.
(2) First-line styles just don't transition, but the other lines do  
(i.e., we only transition on the "master" style of a DOM node)
(3) Don't run transitions at all on any lines if a first-line style is  
specified.

I would object to (3), and would be fine with either (1) or (2) as  
solutions.  (2) is what is implemented in WebKit.

dave
(hyatt@apple.com)
Received on Tuesday, 30 June 2009 22:42:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT