Re: [csswg-drafts] [css-logical-1] Interaction of shorthands and logical properties (#3030)

The CSS Working Group just discussed `CSS Logical Properties`, and agreed to the following:

* `RESOLVED: proposal from fremy: During serialization, each logical property group is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same mapping logic are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.`
* `RESOLVED: proposal from fremy:During serialization, each logical property group is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same mapping logic are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: CSS Logical Properties<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/3030<br>
&lt;Rossen_> github: https://github.com/w3c/csswg-drafts/issues/3030<br>
&lt;tantek> fremy: main issue is that in CSS spec it defines how to serialize properties, contains a lot of tricks to merge declarations<br>
&lt;tantek> ... e.g. if you set all four border properties, the rules merge it to a single declaration<br>
&lt;tantek> ... when I looked at the logical properties, this is not as easy<br>
&lt;tantek> ... even if you have all four, you cannot always merge them into a single property<br>
&lt;tantek> ... it means you have to detect this case (e.g. inline-start) and do something smart<br>
&lt;tantek> ... logical and physical properties<br>
&lt;tantek> ... proposing a couple of rules to the serialization steps<br>
&lt;tantek> ... to only merge all four if they are of the same type<br>
&lt;tantek> ... while we were looking at this, a few more updates<br>
&lt;tantek> ... e.g. dbaron proposed if you set the margin property on the style attribute<br>
&lt;tantek> ... there is no reason to keep the margin-inline properties<br>
&lt;tantek> ... the logical ones<br>
&lt;fantasai> (because they have all now been overridden)<br>
&lt;tantek> ... proposal: make sure that the grouping would work<br>
&lt;tantek> ... making sure when you set things you override propertly<br>
&lt;emilio> q+<br>
&lt;tantek> s/propertly/properly<br>
&lt;tantek> emilio: Gecko has the concept of logical property groups<br>
&lt;tantek> ... we added it to the spec<br>
&lt;tantek> ... this concept already exists<br>
&lt;tantek> ... e.g. border-inline-start:10px; border-start:20px;<br>
&lt;tantek> ... Gecko will do the right thing<br>
&lt;tantek> ... the concept is already in the spec. this is an obvious bugfix<br>
&lt;tantek> fremy: the link you sent sounds like exactly what I'm proposing that seems fine<br>
&lt;Rossen_> See the refs for https://drafts.csswg.org/css-logical-1/#logical-property-group<br>
&lt;tantek> s/the link you sent/emilio's link https://drafts.csswg.org/css-logical-1/#logical-property-group<br>
&lt;tantek> fantasai: we should make sure ... interleaved ... then that can be folded into a shorthand<br>
&lt;emilio> https://drafts.csswg.org/cssom/#set-a-css-declaration is already using this concept<br>
&lt;emilio> We should use it from serialization<br>
&lt;tantek> ... the other part of your proposal, if a shorthand is set, then you can drop any previous declarations that set any property in that logical property group<br>
&lt;tantek> fremy: that sounds correct to me<br>
&lt;tantek> Rossen_: do we not have this currently specified? the part you just added fantasai ? in terms of the behavior?<br>
&lt;tantek> fantasai: I think in terms of how everything is supposed to behave like cascade, etc. is defined. this is about CSSOM interaction<br>
&lt;tantek> Rossen_: so this is going into CSSOM then? mostly?<br>
&lt;tantek> fantasai: I guess so. emilio and I will work it out<br>
&lt;tantek> Rossen_: any other opinions?<br>
&lt;tantek> emilio: I need to look a bit more closely at the replace all the physical longhands<br>
&lt;tantek> ... because there are more complex cases<br>
&lt;tantek> ... e.g. shorthands that only override two properties<br>
&lt;tantek> ... like the serialization stuff when stuff is interleaved, that's good<br>
&lt;tantek> ... the replace of the existing physical properties, that may or may not be confusing<br>
&lt;tantek> fantasai: I think they are two separate proposals that happen to be in the same issue<br>
&lt;tantek> Rossen_: can you separate them for resolutions?<br>
&lt;fantasai> First proposal from fremy: During parsing of a css declaration block, shorthands (like margin and all) expands only to the set of longhand (grouped by mapping logic: so either logical or physical) required to describe their value, and by default resort to use physical properties if both sets are possible. Note that they can only expand if they do not contain var() substitutions.<br>
&lt;fantasai> Second proposal from fremy: During serialization, each logical property group is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same mapping logic are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.<br>
&lt;tantek> Rossen_: please read the first one, which is about the behavior specifying, and how declaration blocks behave between shorthands and longhands and logical properties<br>
&lt;tantek> fantasai: looks like I'm finding more pieces of it<br>
&lt;tantek> emilio: the first one I assume every browser already does that<br>
&lt;emilio> s/emilio/fremy<br>
&lt;tantek> ... it's not clear from the spec, but I assume that should work regardless<br>
&lt;fantasai> Third piece from fremy: When removing a shorthand property, all the longhand associated with that shorthand should be removed, regardless of their mapping kind.<br>
&lt;TabAtkins> +1, all sound good<br>
&lt;fantasai> Fourth piece from dbaron: appending a shorthand property could set all of its constituent shorthands of one mapping logic and also remove all of the constituent shorthands of the other.<br>
&lt;tantek> Rossen_: any objections to accepting this first proposal<br>
&lt;tantek> emilio: q, we are talking about shorthands that map to both physical and logical properties? but those do not exist in browser today<br>
&lt;tantek> fremy: it's possible, back them we had proposal for margin, I don't know if we still have that<br>
&lt;tantek> fantasai: we never figured out a syntax that was appropriate<br>
&lt;tantek> fremy: that was mostly to make sure that case worked<br>
&lt;tantek> ... I don't think it's wrong to add this even if we don't have the mechanism<br>
&lt;tantek> emilio: not saying it's wrong, just possibly confusing<br>
&lt;tantek> how would you test it?<br>
&lt;tantek> RESOLVED: proposal from fremy: During serialization, each logical property group is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same mapping logic are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.<br>
&lt;tantek> fremy: mostly the loop needs to be modified<br>
&lt;tantek> Rossen_: wanting make sure everyone is comfortable with accepting this change<br>
&lt;emilio> yeah, +1 for the serialization change, that's unobjectionable imo<br>
&lt;fremy> https://www.w3.org/TR/cssom-1/#serialize-a-css-declaration-block<br>
&lt;tantek> ... without delaying people too much, any objections or wait til Thu morning?<br>
&lt;tantek> fremy: for me both is fine<br>
&lt;Rossen_> RESOLVED: proposal from fremy:During serialization, each logical property group is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same mapping logic are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3030#issuecomment-713189338 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 20 October 2020 23:05:47 UTC