RE: Splitting background-position in two different attributes

'Gecko follows the rule that if some subproperties of a shorthand are inherit or initial, then in order for the shorthand to serialize as other than "", all must be.'

Actually, wait, that's incorrect.  Sub-values at the "set at initial" state are represented by the absence of them in the shorthand.

What you really meant (I hope) was...
'Gecko follows the rule that if some subproperties of a shorthand are inherit, then in order for the shorthand to serialize as other than "", all must be.  If any of the subproperties are unset, then the shorthand should serialize to "".'


Case A - input
background: blue;

Case A - internal state
background-attachment: -prefix-initial;
background-clip: -prefix-initial;
background-color: blue;
background-image: -prefix-initial;
background-origin: -prefix-initial;
background-position: -prefix-initial;
 background-repeat: -prefix-initial;
background-size: -prefix-initial;

Case A - output for query of 'background'
blue


Case B - input
background-color: blue;

Case B - internal state
background-attachment: <unset>
background-clip: <unset>
background-color: blue;
background-image: <unset>
background-origin: <unset>
background-position: <unset>
background-repeat: <unset>
background-size: <unset>

Case B - output for query of 'background'
<empty string>



-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of Brian Manthos
Sent: Thursday, August 18, 2011 11:04 AM
To: L. David Baron; Tab Atkins Jr.
Cc: Øyvind Stenhaug; Alan Gresley; www-style@w3.org
Subject: RE: Splitting background-position in two different attributes

If I could find 'initial' as a keyword in a CR+ spec, I would agree with you.  In the absence of that, it's a future issue not a present issue.

-----Original Message-----
From: L. David Baron [mailto:dbaron@dbaron.org] 
Sent: Thursday, August 18, 2011 10:53 AM
To: Tab Atkins Jr.
Cc: Brian Manthos; Øyvind Stenhaug; Alan Gresley; www-style@w3.org
Subject: Re: Splitting background-position in two different attributes

On Thursday 2011-08-18 10:17 -0700, Tab Atkins Jr. wrote:
> On Thu, Aug 18, 2011 at 10:00 AM, Brian Manthos <brianman@microsoft.com> wrote:
> > Again, an example...
> >        background: blue;
> > is not equivalent to...
> >        background-color: blue;
> > but rather...
> >        background-attachment: scroll;
> >        background-clip: border-box;
> >        background-color: blue;
> >        background-image: none;
> >        background-origin: padding-box;
> >        background-position: 0% 0%;
> >        background-repeat: repeat;
> >        background-size: auto;
> 
> Or, somewhat more simply:
> 
> background-attachment: initial;
> background-clip: initial;
> background-color: blue;
> background-image: initial;
> background-origin: initial;
> background-position: initial;
> background-repeat: initial;
> background-size: initial;

Though depending on the rules for serialization of shorthands, this may be a bad idea.  In particular, since inherit and initial can't be used within a shorthand, Gecko follows the rule that if some subproperties of a shorthand are inherit or initial, then in order for the shorthand to serialize as other than "", all must be.  This vastly simplifies serialization code (and, if we ever specify it, specification).

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla Corporation               http://www.mozilla.com/   𝄂

Received on Thursday, 18 August 2011 18:30:01 UTC