Re: [css3-content] Replacing ::outside with ::inside

2009/4/12 François REMY <fremycompany_pub@yahoo.fr>:
> From: "Giovanni Campagna" <scampa.giovanni@gmail.com>
>>
>> 2009/4/12 François REMY <fremycompany_pub@yahoo.fr>:
>>>
>>> From: "Giovanni Campagna" <scampa.giovanni@gmail.com>
>>>>
>>>> 2009/4/12 François REMY <fremycompany_pub@yahoo.fr>:
>>>>>
>>>>> ::outside can be useful in other case that you
>>>>> don't have mentioned.
>>>>>
>>>>> You look at ::outside only from the border/margin
>>>>> point of view, but it can have many other useful
>>>>> things.
>>>>>
>>>>> With ::outside, you can perform a break outside the
>>>>> element (useful if you want to have an element on a
>>>>> new line but doesn't contains the line break).
>>>>>
>>>>> * First sample :
>>>>>  <myElem>Hello</myElem>
>>>>>  myElem::outside::before { content: '\A'; }
>>>>>
>>>>> Is rendered like :
>>>>>  <br/><myElem>Hello</myElem>
>>>>>
>>>>> * Second sample :
>>>>>  <myElem>Hello</myElem>
>>>>>  myElem::before { content: '\A'; }
>>>>>
>>>>> Is rendered like :
>>>>>  <myElem><br/>Hello</myElem>
>>>>>
>>>>> * Last sample :
>>>>>  <myElem>Hello</myElem>
>>>>>  myElem::inside::before { content: '\A'; }
>>>>>
>>>>> Is rendered like :
>>>>>  <myElem><br/>Hello</myElem>
>>>>
>>>> You think in terms of elements, not of boxes. If all properties are
>>>> moved from "myElem" to "myElem::inside", then the visible effect of
>>>> "myElem::before" is the same of "myElem::outside::before" with
>>>> properties on "myElem".
>>>
>>> But, it's a bad idea, I think, since I'm not putting my properties on
>>> 'myElem::inside' but on 'myElem'.
>>> If CSS Properties can be moved from an element to another in
>>> contradiction
>>> of what the author say,
>>> we're ready for so complex problems that no UA will have this right.
>>
>> I meant: "you author change you selector to include an ::inside
>> pseudo-element"
>
> It's not always possible. If you have in your stylesheet a global rule, and
> you want a specific
> outside effect, you can't eliminate your normal rule, while it's not a
> problem with ::outside.
>
> myElem { // Defined globaly
>   font-size: 7pt; line-height: 7pt
> }
>
> myElem#specialItem::outside { // Defined localy
>   content: '\A\A';
> }
>
>
> Using myElem#specialItem::inside will result in two lines of 7pt, where with
> ::outside, it's the
> size of the font outside of the element (may be 12pt).
>
> If I want the font-size of 'outside' the myElem, how can I do with ::inside
> ?

You forgot two fundamental features of CSS:

1) cascading: if you can locally define myElem#specialItem::inside,
you can also define myElem#specialItem { font-size:inherit;
line-heigth:inherit; }

2) inheritance: line-heigth and font-size are inherited properties,
and all pseudo-elements inherit from their superior parent, regardless
of where they're placed: so myElem#specialItem::outside gets a
line-heigth and a font-size of 7pt

Number 2 is the reason I want to change ::outside with ::inside

>
>>>>> If you have something like that :
>>>>>
>>>>>  <box display-model="ab">
>>>>>     <div display-role="a"></div>
>>>>>     <div display-role="b"></div>
>>>>>  </box>
>>>>>
>>>>> And a CSS like that :
>>>>>  div[display-role="a"]::outside {
>>>>>     margin: 10px;
>>>>>  }
>>>>>
>>>>> It's rendered the same way as :
>>>>>
>>>>>  <box display-model="ab">
>>>>>     <div display="block"><div display-role="a"></div></div>
>>>>>     <div display-role="b"></div>
>>>>>  </box>
>>>>>
>>>>> The display role of the 'inner' div is no more applyable (I think), so
>>>>> it's
>>>>> not in the display-model of the box element.
>>>>> But it seems the spec of display-model is unclear about how the UA must
>>>>> react if an element in a display-model'ed
>>>>> element contains elements that does'nt enter in the model. But it's not
>>>>> a
>>>>> problem of '::outside'.
>>>>
>>>> What? You're mixing XSL:FO (attributes as properties), Template Layout
>>>> (slots), display-model...
>>>
>>> Yes, but only because it's shorter to write in my mail. We can have the
>>> same
>>> in pure CSS.
>>
>> Yes, but it is not "display-role", it is "position".
>>
>>> You've understood what I wanted to say.
>>
>> Not really, but I will try to guess.
>>
>>> Even if my markup is completly wrong
>>> (which it is),
>>> it show what I wanted to say.
>>>
>>> If we have DIV::outside in a display model, it's likely to be as an
>>> element
>>> was wrapping the DIV.
>>> With all consequence that such a thing have. Authors expect so (or, at
>>> least, me).
>>
>> And where does that ::outside get placed? In the "a" slot or in the
>> "@" slot (default position inside a template element)? That is,
>> ::outside is computed before or after moving elements around (for
>> Generated Content and Template Layout)?
>> On the other side, if you used ::inside, everything would be moved
>> into the "a" slot and it would have been clear.
>
> As if you had an annonymous <DIV> outside the element :
>
>>>>>  <box display-model="ab">
>>>>>     <pseudo:div display="block"><div
>>>>> display-role="a"></div></pseudo:div>
>>>>>     <div display-role="b"></div>
>>>>>  </box>
>
>>> I find ::inside counter-intuitive, and not as useful as ::outside. But I
>>> don't want to say your idea is
>>> stupid, it's just not adapted to my expectation for CSS, but others
>>> people
>>> can think otherly, and I
>>> have respect for that, I'm just writing here to say what I think
>>> personnally, that you are wrong in
>>> willing to replace ::outside by ::inside.
>>
>> I instead find counter-intuitive ::outside, and find easier to
>> understand to keep the inheritance in one direction-
>
> Hum, are ::inside and ::outside incompatible ?
> If not, is it possible to have both ?
>
> We should ask some implementors... Most of the time, UA constraints solve
> these problems.
> Maybe I'm wrong in defending ::outside, maybe I'm right, but I can't say it
> because I'm not implementor.

It is because of lack of implementation that I would like to change
"::outside" with "::inside". I hope that this change will make it
easier to implement, and thus more likely to be implemented soon.

>>
>>>>> Regards,
>>>>> Fremy
>>>>>
>>>>> --------------------------------------------------
>>>>> From: "Giovanni Campagna" <scampa.giovanni@gmail.com>
>>>>> Sent: Saturday, April 11, 2009 7:39 PM
>>>>> To: "www-style" <www-style@w3.org>
>>>>> Subject: [css3-content] Replacing ::outside with ::inside
>>>>>
>>>>>> -- background --
>>>>>> This proposal crossed my mind while talking with Tab Atkins about
>>>>>> ::slot in Template Layout. He wanted to allow margins, and to make
>>>>>> those margins not collapse (sort of "box-sizing:margin-box"). I didn't
>>>>>> like the idea, but I did think that allowing some space between
>>>>>> adjacient slots and their borders may be useful. But I thought that
>>>>>> this kind of space is not a margin, but rather a padding (because it
>>>>>> is all around the box and doesn't collapse).
>>>>>> Ok then, how to specify an external padding? You need two boxes, one
>>>>>> inside the other.
>>>>>> I said to myself: I need the Generated Content features... but what
>>>>>> does ::slot()::outside mean? How shall I specify "display:slot"?
>>>>>> This didn't look very good to me
>>>>>>
>>>>>> -- the current situation --
>>>>>> The Generated and Replaced Content Module introduces the ::outside
>>>>>> pseudo-elements, which wraps its superior parent and all its (in flow)
>>>>>> content. This pseudo-element is not implemented in any UA I tested. In
>>>>>> addition, it creates a lot of difficulty on the author side, because
>>>>>> the wrapping generated box still inherits (like every other
>>>>>> pseudo-element) from its superior parent.
>>>>>>
>>>>>> -- my proposal --
>>>>>> Drop ::outside.
>>>>>> Add ::inside, a pseudo-element wrapping all superior parent's content
>>>>>> (but not ::before, ::after, ::alternate or other pseudo-elements). All
>>>>>> properties apply to this pseudo-element (but their meaning is changed,
>>>>>> because it is inside its superior parent like a nested <div>)
>>>>>> This way, to add multiple borders to an element, you say:
>>>>>> .multiple {
>>>>>> border:1px solid yellow;
>>>>>> }
>>>>>> .multiple::inside {
>>>>>> border:1px solid blue;
>>>>>> }
>>>>>> .multiple::inside::inside {
>>>>>> border:1px solid red;
>>>>>> }
>>>>>>
>>>>>> We may introduce the syntax shorthand "::inside(n)".
>>>>>> Not generated ::inside elements are removed, ie if ::inside::inside is
>>>>>> never referenced, ::inside::inside::inside is the same as
>>>>>> ::inside::inside.
>>>>>>
>>>>>> -- use cases --
>>>>>> All of ::outside, plus those case when an appropriate ::outside is not
>>>>>> available, like for example ::slot.
>>>>>>
>>>>>> Giovanni
>>>>>>
>>>>>
>>>
>


Giovanni

Received on Sunday, 12 April 2009 19:24:43 UTC